public function login(LoginRequest $request)
{
$user = User::username($request->username)->first();
if (!$user?->isPwdConfirmed($request->password)) {
abort(Response::HTTP_UNAUTHORIZED, __('The provided credentials were incorrect.'));
}
return $this->authService->issueAccessToken($user);
}
public function logout(Request $request)
{
$request->user()->currentAccessToken()->delete();
return ['message' => 'Successfully logout.'];
}