fcm
fcm copied to clipboard
how to Subscribe token to topic
how to Subscribe token to topic add send notification large number of users
I'am using for setTopic
public function toFcm($notifiable)
{
return FcmMessage::create()
->setData(['type' => $this->screen, 'user_id' => (string)$notifiable->id])
->setTopic('promotion')
->setNotification(\NotificationChannels\Fcm\Resources\Notification::create()
->setTitle($this->title)
->setBody($this->messages)
->setImage('http://example.com/url-to-image-here.png'))
->setAndroid(
AndroidConfig::create()
->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
->setNotification(AndroidNotification::create()->setColor('#0A0A0A'))
)->setApns(
ApnsConfig::create()
->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios'))
);
}
https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html#topic-management