How can the method via
in a notification class can be dinamic by the users preferences, one user maybe want to receive via email, the other one, dont
public function via($notifiable) {
return ['database', 'broadcast', 'mail'];
}
How can the method via
in a notification class can be dinamic by the users preferences, one user maybe want to receive via email, the other one, dont
public function via($notifiable) {
return ['database', 'broadcast', 'mail'];
}
That function is receiving the User (
$notifiable
) as a parameter, you could call a method on the$notifiable
to retrieve the list of channels you want the notification to use.