Open samiaMH opened 4 years ago
if you need to display the response, please use variable to get the response after calling send method, Eg.:
public function sendnotification()
{
$registrationIds = Fcm_info::select(['token'])
->pluck('token')
->toArray();
$responseArr = fcm()
->to($registrationIds)
->priority('normal')
->timeToLive(0)
->notification([
'title' => 'Test FCM',
'body' => 'This is a test of FCM',
])
->send();
// The array will converted to response object automatically by Laravel
return $responseArr;
}
@samiaMH .. also maybe you can try to enable debug response. then check the firebase log in the laravel.log
file.
fcm()
->to($recipients)
// ...
->enableResponseLog()
->send();
if you like, please share the response log here so we can see the problem
//////////////////// method in controller //////////////////// public function sendnotification(){ $registrationIds= array(); $recipients = Fcm_info::select('token')->get();
} //////////////////// route ////////////////////
Route::get('/sendnotification','FcmController@sendnotification')->name('sendnotification');