userRepository->getFirstWhere('email', $request->email); if (!$user || !$this->hash->check($request->password, $user->password)) { abort(Response::HTTP_UNAUTHORIZED, 'Invalid credentials'); } return response()->json([ 'token' => $this->tokenManager->createToken($user)->plainTextToken, ]); } public function logout() { $this->user?->currentAccessToken()->delete(); // @phpstan-ignore-line return response()->noContent(); } }