File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,15 @@ public function login(AuthRequest $request): JsonResponse
31
31
*/
32
32
public function logout (): JsonResponse
33
33
{
34
- $ user = Auth::user ();
35
- $ user ->currentAccessToken ()->delete ();
34
+ if (Auth::check ()) {
35
+ $ user = Auth::user ();
36
+
37
+ $ user ->tokens ()->delete ();
36
38
37
- return $ this ->sendResponse ([], AuthConstants::LOGOUT );
39
+ return $ this ->sendResponse ([], AuthConstants::LOGOUT );
40
+ }
41
+
42
+ return $ this ->sendError (AuthConstants::UNAUTHORIZED );
38
43
}
39
44
40
45
/**
Original file line number Diff line number Diff line change 7
7
8
8
class Authenticate extends Middleware
9
9
{
10
+ /**
11
+ * @param [type] $request
12
+ * @param array $guards
13
+ * @return void
14
+ */
15
+ protected function unauthenticated ($ request , array $ guards )
16
+ {
17
+ }
18
+
10
19
/**
11
20
* Get the path the user should be redirected to when they are not authenticated.
12
21
*/
You can’t perform that action at this time.
0 commit comments