I'm trying to ->notify()
different users of the same type via different notification methods.
For example: I have TicketCompleted
notification and its via()
method contains: return ['mail', 'database'];
. I also have both methods toArray()
and toMail()
implemented. So what I'm trying to do is the following:
Model Client
that has role Accountant
should be notified only via toArray()
method;
Model Client
that has role Contact
should be notified only via toEmail()
method;
How to achieve this?
You can return different values in
via()
:If you use the same Notification for other models you also have to check the class of
$notifiable
.