Created
February 4, 2020 07:31
-
-
Save godilite/25027a54fa1c626794dfd55159d83350 to your computer and use it in GitHub Desktop.
Logout Mthod of Larave API with Passport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function logout(Request $res) | |
{ | |
if (Auth::user()) { | |
$user = Auth::user()->token(); | |
$user->revoke(); | |
return response()->json([ | |
'success' => true, | |
'message' => 'Logout successfully' | |
]); | |
}else { | |
return response()->json([ | |
'success' => false, | |
'message' => 'Unable to Logout' | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment