Skip to content

Instantly share code, notes, and snippets.

@godilite
Created February 4, 2020 07:31
Show Gist options
  • Save godilite/25027a54fa1c626794dfd55159d83350 to your computer and use it in GitHub Desktop.
Save godilite/25027a54fa1c626794dfd55159d83350 to your computer and use it in GitHub Desktop.
Logout Mthod of Larave API with Passport
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