userRepository->getFirstWhere('email', $email); if (!$user || !$this->hash->check($password, $user->password)) { throw new InvalidCredentialsException(); } if ($this->hash->needsRehash($user->password)) { $user->password = $this->hash->make($password); $user->save(); } return $this->tokenManager->createCompositeToken($user); } public function logoutViaBearerToken(string $token): void { $this->tokenManager->deleteCompositionToken($token); } public function trySendResetPasswordLink(string $email): bool { return $this->passwordBroker->sendResetLink(['email' => $email]) === Password::RESET_LINK_SENT; } public function tryResetPasswordUsingBroker(string $email, string $password, string $token): bool { $credentials = [ 'email' => $email, 'password' => $password, 'password_confirmation' => $password, 'token' => $token, ]; $status = $this->passwordBroker->reset($credentials, function (User $user, string $password): void { $user->password = $this->hash->make($password); $user->save(); event(new PasswordReset($user)); }); return $status === Password::PASSWORD_RESET; } }