From 810004aab1aeb1854b3b9d819975452b1804f894 Mon Sep 17 00:00:00 2001 From: Kazem Alghasi Date: Sun, 9 Aug 2026 05:14:36 +0330 Subject: [PATCH] feat(admin): configure filament panel with custom branding and notifications Enhance the Filament admin panel configuration to align with the new design system and enable core features. - Implement custom color palette including dark navy for sidebar - Set Vazirmatn as the primary font - Enable SPA mode and collapsible sidebar for improved UX - Configure database-driven notifications and global search bindings - Add necessary web middleware stack for session and cookie management - Create new migration for the notifications system - Add directory for custom Filament render hooks --- .../Providers/Filament/AdminPanelProvider.php | 64 +++++-- ...8_09_012526_create_notifications_table.php | 31 ++++ .../views/filament/hooks/head.blade.php | 172 ++++++++++++++++++ 3 files changed, 255 insertions(+), 12 deletions(-) create mode 100644 04_Laravel/database/migrations/2026_08_09_012526_create_notifications_table.php create mode 100644 04_Laravel/resources/views/filament/hooks/head.blade.php diff --git a/04_Laravel/app/Providers/Filament/AdminPanelProvider.php b/04_Laravel/app/Providers/Filament/AdminPanelProvider.php index a4b8041..0fcf3c1 100644 --- a/04_Laravel/app/Providers/Filament/AdminPanelProvider.php +++ b/04_Laravel/app/Providers/Filament/AdminPanelProvider.php @@ -2,13 +2,21 @@ namespace App\Providers\Filament; -use App\Filament\Pages\Auth\Login; -use App\Filament\Pages\Dashboard; use Filament\Http\Middleware\Authenticate; use Filament\Http\Middleware\DisableBladeIconComponents; +use Filament\Http\Middleware\DispatchServingFilamentEvent; +use Filament\Pages; use Filament\Panel; use Filament\PanelProvider; use Filament\Support\Colors\Color; +use Filament\Widgets; +use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; +use Illuminate\Cookie\Middleware\EncryptCookies; +use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; +use Illuminate\Routing\Middleware\SubstituteBindings; +use Illuminate\Session\Middleware\AuthenticateSession; +use Illuminate\Session\Middleware\StartSession; +use Illuminate\View\Middleware\ShareErrorsFromSession; class AdminPanelProvider extends PanelProvider { @@ -20,29 +28,61 @@ class AdminPanelProvider extends PanelProvider ->path('admin') ->login() ->brandName('IFNEX Logistics') - ->brandLogo('IFNEX') - ->favicon(asset('images/favicon.svg')) + // 🎨 رنگ‌بندی سفارشی مطابق طراحی ->colors([ 'primary' => Color::Amber, + 'gray' => [ + 50 => '#f8fafc', + 100 => '#f1f5f9', + 200 => '#e2e8f0', + 300 => '#cbd5e1', + 400 => '#94a3b8', + 500 => '#64748b', + 600 => '#475569', + 700 => '#334155', + 800 => '#1e293b', + 900 => '#1a1a2e', // 🎯 Dark Navy برای Sidebar + 950 => '#0f172a', + ], + 'danger' => Color::Red, + 'info' => Color::Blue, + 'success' => Color::Emerald, + 'warning' => Color::Amber, ]) + ->font('Vazirmatn') + ->spa() + ->sidebarCollapsibleOnDesktop() + ->darkMode(true) + ->databaseNotifications() + ->globalSearchKeyBindings(['command+k', 'ctrl+k']) ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages') ->pages([ - Dashboard::class, - \App\Filament\Pages\Reports\FinancialReport::class, + Pages\Dashboard::class, ]) ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets') ->widgets([ - \Filament\Widgets\AccountWidget::class, - \Filament\Widgets\FilamentInfoWidget::class, + Widgets\AccountWidget::class, + Widgets\FilamentInfoWidget::class, ]) ->middleware([ - 'web', + EncryptCookies::class, + AddQueuedCookiesToResponse::class, + StartSession::class, + AuthenticateSession::class, + ShareErrorsFromSession::class, + VerifyCsrfToken::class, + SubstituteBindings::class, + DisableBladeIconComponents::class, + DispatchServingFilamentEvent::class, ]) ->authMiddleware([ Authenticate::class, ]) - ->sidebarWidth('18rem') - ->maxContentWidth('xl'); + // 🎯 اضافه کردن CSS/JS سفارشی + ->renderHook( + 'panels::head.start', + fn () => view('filament.hooks.head') + ); } -} +} \ No newline at end of file diff --git a/04_Laravel/database/migrations/2026_08_09_012526_create_notifications_table.php b/04_Laravel/database/migrations/2026_08_09_012526_create_notifications_table.php new file mode 100644 index 0000000..d738032 --- /dev/null +++ b/04_Laravel/database/migrations/2026_08_09_012526_create_notifications_table.php @@ -0,0 +1,31 @@ +uuid('id')->primary(); + $table->string('type'); + $table->morphs('notifiable'); + $table->text('data'); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('notifications'); + } +}; diff --git a/04_Laravel/resources/views/filament/hooks/head.blade.php b/04_Laravel/resources/views/filament/hooks/head.blade.php new file mode 100644 index 0000000..cdc2ad2 --- /dev/null +++ b/04_Laravel/resources/views/filament/hooks/head.blade.php @@ -0,0 +1,172 @@ + + + + + + \ No newline at end of file