Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/AuthController.php
Show All 25 Lines | class AuthController extends Controller | ||||
/** | /** | ||||
* Helper method for other controllers with user auto-logon | * Helper method for other controllers with user auto-logon | ||||
* functionality | * functionality | ||||
* | * | ||||
* @param \App\User $user User model object | * @param \App\User $user User model object | ||||
*/ | */ | ||||
public static function logonResponse(User $user) | public static function logonResponse(User $user) | ||||
{ | { | ||||
// @phpstan-ignore-next-line | |||||
$token = Auth::guard()->login($user); | $token = Auth::guard()->login($user); | ||||
return response()->json([ | return response()->json([ | ||||
'status' => 'success', | 'status' => 'success', | ||||
'access_token' => $token, | 'access_token' => $token, | ||||
'token_type' => 'bearer', | 'token_type' => 'bearer', | ||||
// @phpstan-ignore-next-line | // @phpstan-ignore-next-line | ||||
'expires_in' => Auth::guard()->factory()->getTTL() * 60, | 'expires_in' => Auth::guard()->factory()->getTTL() * 60, | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | class AuthController extends Controller | ||||
/** | /** | ||||
* Refresh a token. | * Refresh a token. | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse | * @return \Illuminate\Http\JsonResponse | ||||
*/ | */ | ||||
public function refresh() | public function refresh() | ||||
{ | { | ||||
// @phpstan-ignore-next-line | |||||
return $this->respondWithToken(Auth::guard()->refresh()); | return $this->respondWithToken(Auth::guard()->refresh()); | ||||
} | } | ||||
/** | /** | ||||
* Get the token array structure. | * Get the token array structure. | ||||
* | * | ||||
* @param string $token Respond with this token. | * @param string $token Respond with this token. | ||||
* | * | ||||
Show All 14 Lines |