36 lines
783 B
PHP
36 lines
783 B
PHP
<?php
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
use NotificationChannels\Fcm\FcmChannel;
|
|
use NotificationChannels\Fcm\FcmMessage;
|
|
|
|
class NilaiBaruNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
protected $judul;
|
|
protected $pesan;
|
|
|
|
public function __construct($judul, $pesan)
|
|
{
|
|
$this->judul = $judul;
|
|
$this->pesan = $pesan;
|
|
}
|
|
|
|
public function via($notifiable)
|
|
{
|
|
return [FcmChannel::class];
|
|
}
|
|
|
|
public function toFcm($notifiable)
|
|
{
|
|
return FcmMessage::create()
|
|
->setData(['type' => 'nilai_baru'])
|
|
->setNotification([
|
|
'title' => $this->judul,
|
|
'body' => $this->pesan,
|
|
]);
|
|
}
|
|
}
|