0

I made a notification class as MailResetPasswordNotification and edited the mail representation of the notification with the following.

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!');
}

I also found the file for resetting password in vendor/laravel/framework/src/illuminate/Auth/Passwords/CanResetPassword.php and overrode it with mine like:

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));
    }
}

However, I get the following error.

Class 'Illuminate\Auth\Passwords\App\Notifications\MailResetPasswordNotification' not found

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
Elementor
  • 57
  • 7

1 Answers1

0

You need to create a method sendPasswordResetNotification in a class that implements CanResetPassword

knubbe
  • 1,132
  • 2
  • 12
  • 21