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

Driver [NotificationChannels\\Fcm\\FcmChannel] not supported #180

Closed rabeeaali closed 8 months ago

rabeeaali commented 8 months ago
 "laravel-notification-channels/fcm": "^4.1",
Message
Driver [NotificationChannels\Fcm\FcmChannel] not supported.
Level
ERROR
Exception

{
    "class": "InvalidArgumentException",
    "message": "Driver [NotificationChannels\\Fcm\\FcmChannel] not supported.",
    "code": 0,
    "file": "/home/forge/back.sadafiq.com/vendor/laravel/framework/src/Illuminate/Support/Manager.php:109",

the clase:

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use NotificationChannels\Fcm\FcmChannel;
use NotificationChannels\Fcm\FcmMessage;
use NotificationChannels\Fcm\Resources\Notification as FcmNotification;

class OrderNotification extends Notification implements ShouldQueue
{
    use Queueable;

    public function via($notifiable)
    {
        return [FcmChannel::class];
    }

    public function toFcm($notifiable): FcmMessage
    {
        return (new FcmMessage(notification: new FcmNotification(
            title: 'Account Activated',
            body: 'Your account has been activated.',
            image: 'http://example.com/url-to-image-here.png'
        )))
            ->data(['data1' => 'value', 'data2' => 'value2']);
    }
}
rabeeaali commented 8 months ago

solve the issue by restart the queue:work