链接设置在Illuminate\Auth\Notifications\ResetPassword。这是密码重置请求发出的通知。
此通知在 Illuminate\Auth\Passwords\CanResetPassword 中初始化,这是一个在其他任何地方都没有的特征,而不是您的 App\User 模型。
所以您需要做的就是创建自己的重置通知并覆盖您的User 模型上的sendPasswordResetNotification 方法,如下所示:
php artisan make:notification MyResetPasswordNotification
编辑app/Notifications/MyResetPasswordNotification.php
<?php
namespace App\Notifications;
use Illuminate\Notifications\Messages\MailMessage;
class MyResetPasswordNotification extends \Illuminate\Auth\Notifications\ResetPassword
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('You are receiving this email because we received a password reset request for your account.')
->action('Reset Password', url('YOUR URL', $this->token))
->line('If you did not request a password reset, no further action is required.');
}
}
然后将此添加到app/User.php
/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new \App\Notifications\MyResetPasswordNotification($token));
}
当然,您需要创建自己的路线,正如您在问题中所写的那样,您还必须更改刀片视图。