Solved my own problem. The exact code above does actually work. ;-)
Apr 16, 2018
5
Level 19
How to customize password resets using toMailUsing
Hi,
the usual way of customizing this would be to create your own notification and use it by overriding the sendPasswordResetNotification-Method on your User model (see here).
Now Taylor added a toMailUsing()-method to the ResetPassword notification and recommended using it instead of creating a new notification. I just have no idea how to do that. My current approach is something like this, but it doesn't work:
public function sendPasswordResetNotification($token)
{
$notification = new ResetPasswordNotification($token);
$notification->toMailUsing(function () use ($token) {
return (new MailMessage)
->line('You are receiving this email because we received a password reset request for your account.')
->action('Reset Password', url(config('app.url').route('password.reset', $token, false)))
->line('If you did not request a password reset, no further action is required.');
});
$this->notify($notification);
}
Any ideas?
Please or to participate in this conversation.