From b60e56852b1b9def8f284770894edf78e304aad9 Mon Sep 17 00:00:00 2001 From: ankitcodes4u Date: Sat, 28 Jun 2025 04:31:08 +0545 Subject: [PATCH 1/5] feat: both panel have separate theme --- src/Providers/FrontendPanelProvider.php | 31 +++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Providers/FrontendPanelProvider.php b/src/Providers/FrontendPanelProvider.php index 5c6d649..46e21bd 100644 --- a/src/Providers/FrontendPanelProvider.php +++ b/src/Providers/FrontendPanelProvider.php @@ -24,13 +24,16 @@ use Illuminate\Support\Facades\Blade; use Illuminate\View\Middleware\ShareErrorsFromSession; use pxlrbt\FilamentEnvironmentIndicator\EnvironmentIndicatorPlugin; +use Filament\View\PanelsRenderHook; class FrontendPanelProvider extends PanelProvider { + private const PANEL_ID = 'frontend'; + public function panel(Panel $panel): Panel { return $panel - ->id('frontend') + ->id(self::PANEL_ID) ->path('') ->login() ->passwordReset() @@ -40,7 +43,7 @@ public function panel(Panel $panel): Panel 'gray' => Color::Slate, ]) ->topNavigation() - ->brandName(fn () => Registry::getSite()->name) + ->brandName(fn() => Registry::getSite()->name) ->discoverResources(in: app_path('Filament/Frontend/Resources'), for: 'App\\Filament\\Frontend\\Resources') ->discoverPages(in: app_path('Filament/Frontend/Pages'), for: 'App\\Filament\\Frontend\\Pages') ->pages([ @@ -67,7 +70,7 @@ public function panel(Panel $panel): Panel ]) ->globalSearch(GlobalSearchProvider::class) ->globalSearchKeyBindings(['ctrl+k', 'command+k']) - ->globalSearchFieldSuffix(fn (): ?string => match (Platform::detect()) { + ->globalSearchFieldSuffix(fn(): ?string => match (Platform::detect()) { Platform::Windows, Platform::Linux => 'CTRL+K', Platform::Mac => '⌘K', default => null, @@ -77,13 +80,31 @@ public function panel(Panel $panel): Panel ->tenantMenu(false) ->plugins([ EnvironmentIndicatorPlugin::make(), - ]); + ]) + ->renderHook( + PanelsRenderHook::TOPBAR_END, + fn(): string => self::getThemeIsolationScript(self::PANEL_ID) + ); } public function register(): void { parent::register(); - FilamentView::registerRenderHook('panels::body.end', fn (): string => Blade::render("@vite('resources/js/app.js')")); + FilamentView::registerRenderHook('panels::body.end', fn(): string => Blade::render("@vite('resources/js/app.js')")); + } + + private static function getThemeIsolationScript(string $panelId): string + { + return ""; } } From a0fa3186d68c4a3d8a89d6479b704daa6df56624 Mon Sep 17 00:00:00 2001 From: ankitcodes4u Date: Mon, 30 Jun 2025 16:33:56 +0545 Subject: [PATCH 2/5] fix: changing auth guard changing session --- src/Providers/FrontendPanelProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Providers/FrontendPanelProvider.php b/src/Providers/FrontendPanelProvider.php index 46e21bd..0a43317 100644 --- a/src/Providers/FrontendPanelProvider.php +++ b/src/Providers/FrontendPanelProvider.php @@ -42,6 +42,7 @@ public function panel(Panel $panel): Panel 'primary' => Color::Cyan, 'gray' => Color::Slate, ]) + ->authGuard(self::PANEL_ID) ->topNavigation() ->brandName(fn() => Registry::getSite()->name) ->discoverResources(in: app_path('Filament/Frontend/Resources'), for: 'App\\Filament\\Frontend\\Resources') From ff42e5f78ed70165f673e2c4e69a1bc95709d5a7 Mon Sep 17 00:00:00 2001 From: ankitcodes4u Date: Tue, 1 Jul 2025 02:46:14 +0545 Subject: [PATCH 3/5] fix: flicker effect & redirect issue --- src/Filament/Pages/Auth/Login.php | 22 ++++++++++++++++++++++ src/Http/Middleware/RedirectAfterLogin.php | 18 ++++++++++++++++++ src/Providers/FrontendPanelProvider.php | 10 +++++++--- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/Filament/Pages/Auth/Login.php create mode 100644 src/Http/Middleware/RedirectAfterLogin.php diff --git a/src/Filament/Pages/Auth/Login.php b/src/Filament/Pages/Auth/Login.php new file mode 100644 index 0000000..76fbf39 --- /dev/null +++ b/src/Filament/Pages/Auth/Login.php @@ -0,0 +1,22 @@ +form->fill([ + 'email' => 'test@example.com', + 'password' => 'test123', + 'remember' => true, + ]); + } + } +} \ No newline at end of file diff --git a/src/Http/Middleware/RedirectAfterLogin.php b/src/Http/Middleware/RedirectAfterLogin.php new file mode 100644 index 0000000..8d52105 --- /dev/null +++ b/src/Http/Middleware/RedirectAfterLogin.php @@ -0,0 +1,18 @@ +routeIs('filament.frontend.auth.login')) { + session()->put('url.intended', '/'); + } + + return $next($request); + } +} \ No newline at end of file diff --git a/src/Providers/FrontendPanelProvider.php b/src/Providers/FrontendPanelProvider.php index 0a43317..e2ddfce 100644 --- a/src/Providers/FrontendPanelProvider.php +++ b/src/Providers/FrontendPanelProvider.php @@ -5,6 +5,8 @@ use Eclipse\Common\Providers\GlobalSearchProvider; use Eclipse\Core\Models\Site; use Eclipse\Core\Services\Registry; +use Eclipse\Frontend\Filament\Pages\Auth\Login; +use Eclipse\Frontend\Http\Middleware\RedirectAfterLogin; use Filament\Http\Middleware\Authenticate; use Filament\Http\Middleware\AuthenticateSession; use Filament\Http\Middleware\DisableBladeIconComponents; @@ -35,7 +37,7 @@ public function panel(Panel $panel): Panel return $panel ->id(self::PANEL_ID) ->path('') - ->login() + ->login(Login::class) ->passwordReset() ->emailVerification() ->colors([ @@ -65,6 +67,7 @@ public function panel(Panel $panel): Panel SubstituteBindings::class, DisableBladeIconComponents::class, DispatchServingFilamentEvent::class, + RedirectAfterLogin::class ]) ->authMiddleware([ Authenticate::class, @@ -83,9 +86,10 @@ public function panel(Panel $panel): Panel EnvironmentIndicatorPlugin::make(), ]) ->renderHook( - PanelsRenderHook::TOPBAR_END, + PanelsRenderHook::HEAD_START, fn(): string => self::getThemeIsolationScript(self::PANEL_ID) - ); + ) + ; } public function register(): void From 58c3b652a16fa8329081a8e473c12fdc4c750954 Mon Sep 17 00:00:00 2001 From: ankitcodes4u Date: Sat, 28 Jun 2025 04:31:08 +0545 Subject: [PATCH 4/5] feat: both panel have separate theme --- src/Providers/FrontendPanelProvider.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Providers/FrontendPanelProvider.php b/src/Providers/FrontendPanelProvider.php index cca0831..cda23a7 100644 --- a/src/Providers/FrontendPanelProvider.php +++ b/src/Providers/FrontendPanelProvider.php @@ -62,7 +62,7 @@ public function panel(Panel $panel): Panel $pages[] = Pages\Dashboard::class; } - $panel + $panel = $panel ->id(self::PANEL_ID) ->path('') ->login(Login::class) @@ -74,14 +74,14 @@ public function panel(Panel $panel): Panel ]) ->authGuard(self::PANEL_ID) ->topNavigation() - ->brandName(fn () => Registry::getSite()->name) + ->brandName(fn() => Registry::getSite()->name) ->discoverResources(in: app_path('Filament/Frontend/Resources'), for: 'App\\Filament\\Frontend\\Resources') ->discoverPages(in: app_path('Filament/Frontend/Pages'), for: 'App\\Filament\\Frontend\\Pages') ->discoverWidgets(in: app_path('Filament/Frontend/Widgets'), for: 'App\\Filament\\Frontend\\Widgets') ->pages($pages) ->globalSearch(GlobalSearchProvider::class) ->globalSearchKeyBindings(['ctrl+k', 'command+k']) - ->globalSearchFieldSuffix(fn (): ?string => match (Platform::detect()) { + ->globalSearchFieldSuffix(fn(): ?string => match (Platform::detect()) { Platform::Windows, Platform::Linux => 'CTRL+K', Platform::Mac => '⌘K', default => null, @@ -96,7 +96,11 @@ public function panel(Panel $panel): Panel ->middleware($middleware) ->plugins(array_merge([ EnvironmentIndicatorPlugin::make(), - ], app(Registry::class)->getPlugins())); + ], app(Registry::class)->getPlugins())) + ->renderHook( + PanelsRenderHook::HEAD_START, + fn(): string => self::getThemeIsolationScript(self::PANEL_ID) + ); match ($this->allowGuestAccess()) { true => $panel @@ -108,10 +112,6 @@ public function panel(Panel $panel): Panel ->authMiddleware([ Authenticate::class, ]) - ->renderHook( - PanelsRenderHook::HEAD_START, - fn (): string => self::getThemeIsolationScript(self::PANEL_ID) - ) }; return $panel; @@ -121,7 +121,7 @@ public function register(): void { parent::register(); - FilamentView::registerRenderHook('panels::body.end', fn (): string => Blade::render("@vite('resources/js/app.js')")); + FilamentView::registerRenderHook('panels::body.end', fn(): string => Blade::render("@vite('resources/js/app.js')")); } private static function getThemeIsolationScript(string $panelId): string From 4bebc15e315fa19134d81f6485830b4b6120fdd4 Mon Sep 17 00:00:00 2001 From: ankitcodes4u Date: Mon, 22 Sep 2025 01:01:59 +0545 Subject: [PATCH 5/5] fix: fixing a bug with email verification --- src/Providers/FrontendPanelProvider.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Providers/FrontendPanelProvider.php b/src/Providers/FrontendPanelProvider.php index cda23a7..31be614 100644 --- a/src/Providers/FrontendPanelProvider.php +++ b/src/Providers/FrontendPanelProvider.php @@ -67,21 +67,20 @@ public function panel(Panel $panel): Panel ->path('') ->login(Login::class) ->passwordReset() - ->emailVerification() ->colors([ 'primary' => Color::Cyan, 'gray' => Color::Slate, ]) ->authGuard(self::PANEL_ID) ->topNavigation() - ->brandName(fn() => Registry::getSite()->name) + ->brandName(fn () => Registry::getSite()->name) ->discoverResources(in: app_path('Filament/Frontend/Resources'), for: 'App\\Filament\\Frontend\\Resources') ->discoverPages(in: app_path('Filament/Frontend/Pages'), for: 'App\\Filament\\Frontend\\Pages') ->discoverWidgets(in: app_path('Filament/Frontend/Widgets'), for: 'App\\Filament\\Frontend\\Widgets') ->pages($pages) ->globalSearch(GlobalSearchProvider::class) ->globalSearchKeyBindings(['ctrl+k', 'command+k']) - ->globalSearchFieldSuffix(fn(): ?string => match (Platform::detect()) { + ->globalSearchFieldSuffix(fn (): ?string => match (Platform::detect()) { Platform::Windows, Platform::Linux => 'CTRL+K', Platform::Mac => '⌘K', default => null, @@ -99,7 +98,7 @@ public function panel(Panel $panel): Panel ], app(Registry::class)->getPlugins())) ->renderHook( PanelsRenderHook::HEAD_START, - fn(): string => self::getThemeIsolationScript(self::PANEL_ID) + fn (): string => self::getThemeIsolationScript(self::PANEL_ID) ); match ($this->allowGuestAccess()) { @@ -121,7 +120,7 @@ public function register(): void { parent::register(); - FilamentView::registerRenderHook('panels::body.end', fn(): string => Blade::render("@vite('resources/js/app.js')")); + FilamentView::registerRenderHook('panels::body.end', fn (): string => Blade::render("@vite('resources/js/app.js')")); } private static function getThemeIsolationScript(string $panelId): string