类扩展通知
public function via($notifiable)
{
if($this->dontSend($notifiable)) {
return [];
}
return ['mail'];
}
public function dontSend($notifiable)
{
return $this->appointment->status === 'cancelled';
}
protected $listen = [
NotificationSending::class => [
NotificationSendingListener::class,
],
];
类通知SendingListener
public function handle(NotificationSending $event)
{
if (method_exists($event->notification, 'dontSend')) {
return !$event->notification->dontSend($event->notifiable);
}
return true;
}
有关更多详细信息,请参阅本文
Handling delayed notifications in Laravel