laravel-notification-channels / fcm

Firebase Cloud Messaging (FCM) notifications channel for Laravel
https://laravel-notification-channels.com/
MIT License
472 stars 121 forks source link

Refactor FcmMessage to make simpler #172

Closed dwightwatson closed 10 months ago

dwightwatson commented 10 months ago

This makes a few major changes to greatly simplify the interface of FcmMessage so that it generally covers 90% off the use-case with ease, but still allows it to be used for more advanced use-cases as required.

If you need to build a highly specific custom message to send you can simply return what you like from toFcm instead of using our FcmMessage instance. Alternatively, you can now use custom an instance to instead provide your own additional custom configuration with arrays.

use NotificationChannels\Fcm\FcmMessage;
use NotificationChannels\Fcm\Resources\Notification;

$message = FcmMessage::create()
    ->name('name')
    ->notification(Notification::create()->title('title'))
    ->custom([
        'android' => [
            // ...
        ],
    ]);

Todo

dwightwatson commented 10 months ago

Upon reflection I think it may still be worth keeping the Notification instance around.