kawankoding/laravel-fcm

do you know if this works with iphone device token and Firebase?

olkotz opened this issue · 4 comments

Hellow, first, thanks for share your work with us.

I dont have any response when i send notifications to an iPhone device. With php Curl the notifications works fine, but when i use FCM dosent send.

This is my code:

$fcm_token = User::select('fcm_token')->where('id',$request->partner_id)->first()->toArray();
$respuesta = fcm()
->to($fcm_token) // $recipients must an array
->priority('normal')
->timeToLive(0)
->data([
'sender_id' => intval($request->user_id),
'sender_name' => $user->name,
'type' => 'partner',
'date' => $request->date,
'shift' => $user->shift_id
])
->notification([
'title' => 'Test FCM',
'body' => 'This is a test of FCM',
])
->send();
->send();

And the return of json_encode($respuesta) is {}

Thanks again!!

$fcm_token = User::select('fcm_token')
    ->where('id', $request->partner_id)
    ->first()
    ->fcm_token;

$respuesta = fcm()
    ->to([$fcm_token])
    // ...

Thanks for answer so fast!!!

still return {} with the changes that you propose....

@olkotz

have you added .env
FCM_SERVER_KEY=yourkeyhere

then execute
php artisan config:cache

?

Hi, @olkotz .. 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