0

我创建了一个通知类,MailResetPasswordNotification并使用以下内容编辑了通知的邮件表示。

public function toMail($notifiable)
{
    $link = url("/password/reset/?token=".$this->token);

    return (new MailMessage)
        ->view('reset.emailer')
        ->from('info@example.com')
        ->subject('Reset your password')
        ->line("Hey, We've successfully changed the text ")
        ->action('Reset Password', $link)
        ->attach('reset.attachment')
        ->line('Thank you!');
}

我还找到了用于重置密码的文件,vendor/laravel/framework/src/illuminate/Auth/Passwords/CanResetPassword.php并用我的方法覆盖了它,例如:

namespace Illuminate\Auth\Passwords;

use Illuminate\Auth\Notifications\ResetPassword as MailResetPasswordNotification;

trait CanResetPassword
{
    public function getEmailForPasswordReset()
    {
        return $this->email;
    }

    public function sendPasswordResetNotification($token)
    {
        $this->notify(new App\Notifications\MailResetPasswordNotification($token));
    }
}

但是,我收到以下错误。

找不到类“Illuminate\Auth\Passwords\App\Notifications\MailResetPasswordNotification”

4

1 回答 1

0

您需要sendPasswordResetNotification在实现的类中创建一个方法CanResetPassword

于 2019-12-05T12:32:18.387 回答