From 1d19739a3dde142fe2c99a871409e6739c1c4e87 Mon Sep 17 00:00:00 2001 From: hameesak <78894707+hameesak@users.noreply.github.com> Date: Sat, 12 Nov 2022 15:18:58 +0500 Subject: [PATCH] Suppress notification if notifier address is NULL Other drivers allows notification suppression by returning null from route methods This driver can provide same functionality as well --- src/TwilioChannel.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/TwilioChannel.php b/src/TwilioChannel.php index e5cc8f9..ba24b49 100755 --- a/src/TwilioChannel.php +++ b/src/TwilioChannel.php @@ -45,6 +45,10 @@ public function send($notifiable, Notification $notification) { try { $to = $this->getTo($notifiable, $notification); + + // Suppress notification if notifier address is found to be NULL + if($to === null) return; + $message = $notification->toTwilio($notifiable); $useSender = $this->canReceiveAlphanumericSender($notifiable);