PHP code example of azi / laravel-fcm-channel
1. Go to this page and download the library: Download azi/laravel-fcm-channel library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
azi / laravel-fcm-channel example snippets
use NotificationChannels\FCM\FCMMessage;
use Illuminate\Notifications\Notification;
class ExampleNotification extends Notification
{
public function via($notifiable)
{
return ['fcm'];
}
public function toFCM($notifiable)
{
return (new FCMMessage())
->notification([
'title' => 'Notification title',
'body' => 'Notification body',
]);
}
}
php
'providers' => [
// ...
NotificationChannels\FCM\ServiceProvider::class
]