lundi 21 décembre 2015

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

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 the line below in function postEmail():

$response = Password::sendResetLink($request->only('email'), function (Message $message) {
            $message->subject($this->getEmailSubject());
        }); 

Digging further I notice that sendResetLink() function is implemented in a PasswordBroker class which in turn calls the function emailResetLink(). emailResetLink function returns the following:

return $this->mailer->send($view, compact('token', 'user'), function ($m) use ($user, $token, $callback) {
            $m->to($user->getEmailForPasswordReset());

which I can simply change mailer->send to mailer->queue. Is they some better way to do it without modifying this non-project file?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire