i am getting this when i want to send push notifications to all users through firebase, I chunked array but getting same error. please help
$noti_title = $request->notif_title;
$noti_body = $request->notif_body;
if ($request->notif_to == 1) {
$all_users = \App\User::orderBy('id','desc')->pluck('id')->toArray();
$all_user = array_chunk($all_users, 600);
$all_firebase_tokens = [];
foreach($all_user as $numbers){
foreach($numbers as $number){
array_push($all_firebase_tokens, \App\UserDeviceId::WhereIn('user_id',[$number])->pluck('firebase_token')->toArray());
}
}
if(count($all_firebase_tokens) > 0) {
$message = [
"registration_ids" => $all_firebase_tokens,
"priority" => 'high',
"sound" => 'default',
"badge" => '1',
"data" =>
[
"title" => $noti_title,
"body" => $noti_body,
"type" => 'Admin_notification',
],
"notification" =>
[
"title" => $noti_title,
"body" => $noti_body,
"type" => 'Admin_notification',
]
];
return \App\PushNotification::send($message);
}