Open SayedAbbady opened 6 months ago
device_tokens
as castable array on user model.
$deviceTokens = $notifiable->device_tokens;
foreach ($deviceTokens as $t) {
Larafirebase::withTitle('Test Notification')
->withBody('I have something new to share with you!')
->withImage('https://firebase.google.com/images/social.png')
->withToken($t)
->sendNotification();
}
Hi, in the last repository this was possible, because Firebase supported sending multiple tokens in the request-Body. However, this api has been discontinued. They now advice to iterate through your list of tokens and to send a request for each token: https://firebase.google.com/docs/cloud-messaging/send-message?hl=de#send-messages-to-multiple-devices
In the previous package, it was possible to provide an array of tokens and firebase would send a notification to each one, but in this package, it only allows to accept 1 token as a string and not an array.
larafirebase]