Skip to content

Conversation

@dwightwatson
Copy link
Collaborator

This introduces a new FcmTopicChannel (see #192) that allows sending FCM notifications to topics. It's important to understand why this is implemented as a separate channel and is designed to work a little differently to other notifications that are sent to notifiable models.

My general expectation is that this would be used as an on-demand notification where you would dispatch the notification to a topic in real-time.

use NotificationChannels\Fcm\FcmTopicChannel;

Notification::route(FcmTopicChannel::class, 'news')
    ->notify(new BlogCreated($blog));

However - you can still implement routeNotifiationForFcmTopic on a model and send a notification that way, or set the topic on the message itself. Perhaps this could be expanded to support multiple topics at the same time (if the API allows) but I chose not to implement this here.

I updated the docs, cleaned up some additional code and also adopted Pint for consistency going forward.

@dwightwatson dwightwatson merged commit 4e05938 into master Nov 16, 2025
6 of 7 checks passed
@dwightwatson dwightwatson deleted the topics branch November 16, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants