本文整理汇总了PHP中Illuminate\Auth\Passwords\PasswordBroker::sendResetLink方法的典型用法代码示例。如果您正苦于以下问题:PHP PasswordBroker::sendResetLink方法的具体用法?PHP PasswordBroker::sendResetLink怎么用?PHP PasswordBroker::sendResetLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Auth\Passwords\PasswordBroker
的用法示例。
在下文中一共展示了PasswordBroker::sendResetLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postReset
public function postReset(Request $request, PasswordBroker $broker)
{
$credentials = $request->only('email');
Validator::make($credentials, ['email' => 'required|email']);
$response = $broker->sendResetLink($credentials, function ($m) {
$m->subject('Reset Password');
});
switch ($response) {
case PasswordBroker::RESET_LINK_SENT:
return response()->json('Password reset sent.');
case PasswordBroker::INVALID_USER:
return response()->json(trans($response))->setStatusCode(412, 'Invalid User');
}
}
示例2: postRemind
/**
* Send an email to user if exists with reset instructions
* @param AuthRequestInterface $request
* @param PasswordBroker $passwords
* @return Illuminate\Http\Response
*/
public function postRemind(AuthRequestInterface $request, PasswordBroker $passwords)
{
$response = $passwords->sendResetLink($request->only('email'), function (Message $message) {
$message->subject(trans('core::auth.emails.remind.subject'));
});
switch ($response) {
case PasswordBroker::RESET_LINK_SENT:
return $this->reminderWasSent($request);
break;
case PasswordBroker::INVALID_USER:
return $this->reminderWasNotSent($request, $response);
break;
}
}
示例3: sendResetLink
/**
* Send a password reset link to a user.
*
* @param array $credentials
* @param \Closure|null $callback
* @return string
* @static
*/
public static function sendResetLink($credentials, $callback = null)
{
return \Illuminate\Auth\Passwords\PasswordBroker::sendResetLink($credentials, $callback);
}