kawankoding / laravel-fcm

Firebase Cloud Messaging (FCM) sender for Laravel
174 stars 56 forks source link

i need example for sending from controller #14

Closed alimuhnad closed 5 years ago

alimuhnad commented 5 years ago

i need to send notfy by using controller plz help?

sayaamirul commented 5 years ago

you can use this code direct on your controller fcm() ->toTopic($topic) // $topic must an string (topic name) ->notification([ 'title' => 'Test FCM', 'body' => 'This is a test of FCM', ]) ->send();

sayaamirul commented 5 years ago

please check the documentation once more

alimuhnad commented 5 years ago

thank you for replay ...... how can i use it directly without call it from the model ??? i trying to use it on ionic 3 i have one more Q. if i want to send notfcation for one user its need token how can i get it ?

JoseGeorges8 commented 5 years ago

@alimuhnad you get the token from your frontend device. With ionic you could use the firebase plugin here