brozot / Laravel-FCM

Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).
MIT License
888 stars 406 forks source link

Use multiple sender id for multiple apps using brozot #65

Open shivani-ksolves opened 7 years ago

shivani-ksolves commented 7 years ago

I have multiple mobile apps (for each app I manage different server key and sender id) and I am using same laravel backend to send notifications to all different mobile apps. How can I send notification to different app using different sender id (not using single sender id) with laravel brozot package?

solancer commented 7 years ago

I'm facing a similar situation. Is there a way we can override the FCM::send server and sender keys?

dixitchopra commented 7 years ago

I am also facing the same issue. I have two apps one for service providers and other for customers and it has to be the same Laravel backend/application.

mechtech5 commented 7 years ago

Please sort this out and push an update. We will also need the steps to add multiple server keys and sender IDs. Thank You.

brozot commented 7 years ago

Hi everybody

My proposition is to use the pull request of henrique1977 (#52) But I would like to change it a bit to not modifying the config array.

Do you think that this implementation could be good for this issue ?

If yes I will integrate the pull request

Best Regards

cmorales commented 6 years ago

What happened with this? Did henrique1977's fix this got integrated? It seems good for me.

solancer commented 6 years ago

I'm using this version of the codebase and it works like a charm

https://github.com/brozot/Laravel-FCM/pull/52

msankar1991 commented 6 years ago

@solancer 👍 . Can you please update the document or links how you achieved with multiple senders(projects).

ghost commented 6 years ago

you can add condition according to your app if(app=='1'){ //if you want to send notification to first app config(['fcm.http.server_key' => 'your first app server key']); config(['fcm.http.sender_id' => 'your first app sender id']);
}else{ //if you want to send notification to second app config(['fcm.http.server_key' => 'your second app server key']); config(['fcm.http.sender_id' => 'your second app sender id']); }

luolongfei commented 5 years ago

@

you can add condition according to your app if(app=='1'){ //if you want to send notification to first app config(['fcm.http.server_key' => 'your first app server key']); config(['fcm.http.sender_id' => 'your first app sender id']); }else{ //if you want to send notification to second app config(['fcm.http.server_key' => 'your second app server key']); config(['fcm.http.sender_id' => 'your second app sender id']); }

It works like a charm! thx

pixsolution commented 4 years ago

you can add condition according to your app if(app=='1'){ //if you want to send notification to first app config(['fcm.http.server_key' => 'your first app server key']); config(['fcm.http.sender_id' => 'your first app sender id']); }else{ //if you want to send notification to second app config(['fcm.http.server_key' => 'your second app server key']); config(['fcm.http.sender_id' => 'your second app sender id']); }

Hi everyone @luolongfei @brozot I'm facing this issue....So this is the solution? but where I should put that condition? My case is that I use the same firebase server/console for several applications, so the server key would be the same, right? I would only change the sender_id I guess

FutureFutureTo commented 4 years ago

any news on this?

Denesvargas commented 2 years ago

@FutureFutureTo

I've created one repository for each app and just put this two lines above in php before FCM::sendTo of each repository:

config(['fcm.http.server_key' => env('FCM_SERVER_KEY')]); config(['fcm.http.sender_id' => env('FCM_SENDER_ID')]);

FutureFutureTo commented 2 years ago

hey thanks for getting back to me on this...i actually just ended up using the firebase php sdk and rolling my own solution