where('email', $credentials['email'])->first(); if (!$user || !$user->is_active) { throw new AuthenticationException(); } elseif (!$token = auth()->attempt($credentials)) { throw new AuthenticationException(); } return $token; } public function logout(): void { auth()->logout(); } public function me(): User { return UserMapper::fromAuth(auth()->user()); } public function refresh(): string { try { return TymonJWTAuth::parseToken()->refresh(); } catch (JWTException $e) { Log::error($e->getMessage()); throw new AuthenticationException($e->getMessage()); } } }