I'd like my application to use Mailables for all of the emails it sends, so I created my own ResetPasswordEmail
class that extends Mailable
. Then I created my own ResetPassword
notification class that extends the vendor class of the same name and overrode the toMail
method as follows:
public function toMail($notifiable)
{
return (new ResetPasswordEmail())->with('token', $this->token);
}
Then I overrode the sendPasswordResetNotification
from the CanResetPassword
trait in my User
model like this:
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPassword($token));
}
Calling my custom ResetPassword
notification class.
The problem is that if I use the default method of creating a MailMessage
and sending it, it automatically populates the 'to' field with the user's email. But when I use my ResetPasswordEmail
mailable class, it doesn't.
Is there a good way to get it to work like that with my custom mailable?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DrqwPq
via IFTTT
Aucun commentaire:
Enregistrer un commentaire