本文整理匯總了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);
}