%PDF- %PDF-
Direktori : /var/www/html/diaspora/api/app/Notifications/ |
Current File : /var/www/html/diaspora/api/app/Notifications/TestNotification.php |
<?php namespace App\Notifications; use Benwilkins\FCM\FcmMessage; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Notification; class TestNotification extends Notification implements ShouldQueue { use Queueable; /** * @var int */ private $badge; /** * Create a new notification instance. * * @param int $badge */ public function __construct($badge = 1) { $this->badge = $badge; } /** * Get the notification's delivery channels. * * @return array */ public function via() { return ['fcm']; } /** * @return FcmMessage */ public function toFcm() { $message = new FcmMessage(); $message->content([ 'badge' => $this->badge, 'title' => 'Foo', 'body' => 'Bar', 'sound' => '', // Optional 'icon' => '', // Optional 'click_action' => '' // Optional ]); $message->data([ 'event_id' => 2 // Optional ]); $message->priority(FcmMessage::PRIORITY_HIGH); // Optional - Default is 'normal'. return $message; } }