Files
jabali-panel/app/Support/Notifications/Notification.php
2026-01-31 06:33:19 +02:00

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;
}
}