passwords->sendResetLink(['email' => $email->value]) === PasswordBroker::RESET_LINK_SENT; } catch (TransportExceptionInterface $exception) { // The mail server is down or refused the message: log it and let // the caller offer a resend instead of failing the whole action. report($exception); return false; } } public function issueSetupLink(EmailAddress $email): IssuedSetupLink { $user = User::query()->where('email', $email->value)->first() ?? throw new LogicException('A set-password link was asked for an unknown user.'); $token = Password::createToken($user); $url = route('password.reset', [ 'token' => $token, 'email' => $user->getEmailForPasswordReset(), ]); try { $user->sendPasswordResetNotification($token); $emailSent = true; } catch (TransportExceptionInterface $exception) { // The admin still gets the link to hand over another way. report($exception); $emailSent = false; } return new IssuedSetupLink($url, $emailSent); } }