Fix notifications asset override

This commit is contained in:
root
2026-01-31 18:40:18 +02:00
parent 9100d5b031
commit 20264011a4
4 changed files with 1 additions and 45 deletions

View File

@@ -4,9 +4,6 @@ namespace App\Providers;
use App\Models\Domain; use App\Models\Domain;
use App\Observers\DomainObserver; use App\Observers\DomainObserver;
use App\Support\Notifications\Notification as LivewireNotification;
use Filament\Notifications\Notification;
use Filament\Support\Assets\Js;
use Filament\Support\Facades\FilamentAsset; use Filament\Support\Facades\FilamentAsset;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
@@ -18,7 +15,6 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function register(): void public function register(): void
{ {
$this->app->bind(Notification::class, LivewireNotification::class);
} }
/** /**
@@ -32,10 +28,6 @@ class AppServiceProvider extends ServiceProvider
$appVersion = File::exists($versionFile) ? trim(File::get($versionFile)) : null; $appVersion = File::exists($versionFile) ? trim(File::get($versionFile)) : null;
FilamentAsset::appVersion($appVersion ?: null); FilamentAsset::appVersion($appVersion ?: null);
FilamentAsset::register([
Js::make('notifications', public_path('js/app/notifications.js')),
], 'app');
// Note: AuthEventListener is auto-discovered by Laravel 11+ // Note: AuthEventListener is auto-discovered by Laravel 11+
// Do not manually subscribe - it causes duplicate audit log entries // Do not manually subscribe - it causes duplicate audit log entries
} }

View File

@@ -1,27 +0,0 @@
<?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;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -6,15 +6,7 @@
@foreach ($assets as $asset) @foreach ($assets as $asset)
@if (! $asset->isLoadedOnRequest()) @if (! $asset->isLoadedOnRequest())
@php {{ $asset->getHtml() }}
$skipNotificationScript = $asset instanceof \Filament\Support\Assets\Js
&& $asset->getPackage() === 'filament/notifications'
&& $asset->getId() === 'notifications';
@endphp
@if (! $skipNotificationScript)
{{ $asset->getHtml() }}
@endif
@endif @endif
@endforeach @endforeach