28 lines
587 B
PHP
28 lines
587 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Notifications;
|
|
|
|
use Filament\Notifications\Notification as BaseNotification;
|
|
use Livewire\Livewire;
|
|
|
|
class Notification extends BaseNotification
|
|
{
|
|
public function send(): static
|
|
{
|
|
$payload = $this->toArray();
|
|
|
|
if (Livewire::isLivewireRequest()) {
|
|
$component = Livewire::current();
|
|
if ($component) {
|
|
$component->dispatch('notificationSent', $payload);
|
|
}
|
|
}
|
|
|
|
session()->push('filament.notifications', $payload);
|
|
|
|
return $this;
|
|
}
|
|
}
|