simedkom/app/Notifications/BroadcastNotification.php

32 lines
682 B
PHP

<?php
namespace App\Notifications;
use Filament\Notifications\Notification as FilamentNotification;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class BroadcastNotification extends Notification
{
use Queueable;
public function __construct(
protected array $payload
) {
$this->payload = $payload;
}
public function via($notifiable): array
{
return ['database'];
}
public function toDatabase($notifiable): array
{
return FilamentNotification::make()
->title($this->payload['title'])
->body($this->payload['body'])
->getDatabaseMessage();
}
}