【问题标题】:Lavarel Illuminate class for mail reset not found未找到用于电子邮件重置的 Laravel Illuminate 类
【发布时间】:2019-12-05 11:54:30
【问题描述】:

我将通知类设为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”

【问题讨论】:

  • 你的文件CanResetPassword.php在哪里?
  • NOT编辑vendor中的文件......只需覆盖模型上的方法,你必须正确引用类(命名空间)
  • 如何覆盖仅位于供应商中的方法?在任何地方都找不到?@lagbox
  • 你试过composer dump吗?
  • 您在模型上定义覆盖特征版本的方法

标签: php laravel laravel-5 laravel-6 illuminate-container


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2019-06-04
    • 2018-06-20
    • 2015-04-16
    • 1970-01-01
    • 1970-01-01
    • 2016-03-01
    • 2018-05-09
    • 2015-06-15
    • 2019-06-05
    相关资源
    最近更新 更多