hasTooManyLoginAttempts($request)) { $this->fireLockoutEvent($request); $this->sendLockoutResponse($request); } try { return response()->json($this->auth->login($request->email, $request->password)->toArray()); } catch (InvalidCredentialsException) { $this->incrementLoginAttempts($request); abort(Response::HTTP_UNAUTHORIZED, 'Invalid credentials'); } } public function logout(Request $request) { attempt(fn () => $this->auth->logoutViaBearerToken($request->bearerToken())); return response()->noContent(); } /** * For the throttle middleware. */ protected function username(): string { return 'email'; } }