4
4
5
5
use App \Http \Controllers \Controller ;
6
6
use App \Http \Requests \Auth \LoginRequest ;
7
- use Illuminate \Http \Request ;
8
7
use Illuminate \Http \JsonResponse ;
8
+ use Illuminate \Http \Request ;
9
9
use Illuminate \Http \Response ;
10
10
use Illuminate \Support \Facades \Auth ;
11
11
@@ -25,8 +25,8 @@ public function __construct()
25
25
}
26
26
27
27
/**
28
- * Login
29
- *
28
+ * Login
29
+ *
30
30
* Get a JWT via given credentials.
31
31
*/
32
32
public function login (LoginRequest $ request ): JsonResponse
@@ -42,18 +42,17 @@ public function login(LoginRequest $request): JsonResponse
42
42
43
43
/**
44
44
* Authenticated user data
45
- *
45
+ *
46
46
* Get the authenticated User.
47
47
*/
48
- public function me () : JsonResponse
48
+ public function me (): JsonResponse
49
49
{
50
50
return response ()->json (auth ()->user ());
51
51
}
52
52
53
-
54
53
/**
55
- * Logout
56
- *
54
+ * Logout
55
+ *
57
56
* Log the user out (Invalidate the token).
58
57
*/
59
58
public function logout (Request $ request ): Response
@@ -65,27 +64,26 @@ public function logout(Request $request): Response
65
64
66
65
/**
67
66
* Token refresh
68
- *
67
+ *
69
68
* Refresh a token.
70
69
*/
71
- public function refresh () : JsonResponse
70
+ public function refresh (): JsonResponse
72
71
{
73
72
return $ this ->respondWithToken (auth ()->refresh (true , true ));
74
73
}
75
74
76
75
/**
77
76
* Get the token array structure.
78
77
*
79
- * @param string $token
80
- *
78
+ * @param string $token
81
79
* @return \Illuminate\Http\JsonResponse
82
80
*/
83
81
protected function respondWithToken ($ token )
84
82
{
85
83
return response ()->json ([
86
84
'access_token ' => $ token ,
87
85
'token_type ' => 'bearer ' ,
88
- 'expires_in ' => auth ()->factory ()->getTTL () * 60
86
+ 'expires_in ' => auth ()->factory ()->getTTL () * 60 ,
89
87
]);
90
88
}
91
89
}
0 commit comments