Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/FirebaseChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down