//put this code in controller
public function logout()
{
$user = Auth::user()->token();
$user->revoke();
return response()->json('Successfully logged out');
}
public function logout() {
Auth::user()->tokens->each(function($token, $key) {
$token->delete();
});
return response()->json('Successfully logged out');
}