PHP code example of laravel-notification-channels / gcm
1. Go to this page and download the library: Download laravel-notification-channels/gcm 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/ */
laravel-notification-channels / gcm example snippets
use NotificationChannels\Gcm\GcmChannel;
use NotificationChannels\Gcm\GcmMessage;
use Illuminate\Notifications\Notification;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [GcmChannel::class];
}
public function toGcm($notifiable)
{
return GcmMessage::create()
->title('Account approved')
->message("Your {$notifiable->service} account was approved!");
}
}
public function routeNotificationForGcm()
{
return $this->gcm_token;
}