How to send the password reset link via email using queue in laravel 5

后端 未结 3 981
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 14:15

I am using the ResetsPasswords trait by laravel to implement password reset. What I would like to achieve is to send the email using queue. Digging through the code I found

3条回答
  •  死守一世寂寞
    2020-12-16 14:56

    I know this has been answered but I found another way to queue password reset notification which I found much simpler. I've tested it on Laravel 5.3 and 6.x.

    By default, password reset notification is implemented by Illuminate\Auth\Notifications\ResetPassword class. This class is instantiated in your User model in sendPasswordResetNotification method and passed to notify method of Illuminate\Notifications\Notifiable trait.

    So, to queue password reset notification you can simply create new ResetPassword notification class via artisan make:notification ResetPassword and replace it's code with this:

    And now just override sendPasswordResetNotification method in your App\User class:

    notify(new ResetPasswordNotification($token));
    }
    

提交回复
热议问题