Laravel, How To Use Mailable Inside A Notification

If you don’t like use MailMessage object from the toMail method in Notification class, you can use Mailable object (better), but Laravel document not clear in this case.

I don’t like injection a eloquent model into Notification or Mailable. This is better for toMail method

public function toMail($notifiable) {
return (new Mailable())->to($notifiable->email);

But this one will ignore routeNotificationForMail method in eloquent model.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s