laravel-notification-channels / pusher-push-notifications

Pusher Beams notifications channel for Laravel
http://laravel-notification-channels.com
MIT License
270 stars 67 forks source link

Laravel 10 support #80

Closed Mohammad-Yasin-Noori closed 7 months ago

Mohammad-Yasin-Noori commented 9 months ago

I recently worked with this package but not working in laravel v10. The notification is not showing up.

gauravrjoshi commented 7 months ago

I also working on Laravel Framework 10.39.0, and it's not working.

Mohammad-Yasin-Noori commented 7 months ago

@gauravrjoshi I have found a solution but not the package way.

public function toPushNotification($notifiable)
    {
        $beamsClient = new \Pusher\PushNotifications\PushNotifications([
            'instanceId' => config('services.pusher.beams_instance_id'),
            'secretKey' => config('services.pusher.beams_secret_key'),
        ]);

        $publishResponse = $beamsClient->publishToInterests(
            ['App.User.'.$notifiable->id],
            ['web' => [
                'notification' => [
                    'title' => 'New Customer Registered!',
                    'body' => "{$this->customerName} has been registered to the system!",
                ],
            ],
            ]);

        return $publishResponse;
    }