diff --git a/src/FirebaseChannel.php b/src/FirebaseChannel.php index f2873aa..b4b09ed 100644 --- a/src/FirebaseChannel.php +++ b/src/FirebaseChannel.php @@ -49,10 +49,18 @@ public function send($notifiable, Notification $notification) { $devices = $notifiable->routeNotificationFor('firebase'); + if (!method_exists($notifiable, 'routeNotificationForFirebase')) { + throw new Exception('Firebase notification method "routeNotificationForFirebase" is not implemented but was called for ' . $notifiable->getTable()); + } + if (empty($devices)) { return; } + if (!is_array($devices)) { + throw new Exception('Firebase notification method "routeNotificationForFirebase" in ' . $notifiable->getTable() . ' should return an array'); + } + $firebase = $notification->toFirebase($notifiable); try {