From 7bb86f2347aeaf459e9309996d4337930540e5ce Mon Sep 17 00:00:00 2001 From: Boy132 Date: Fri, 1 Nov 2024 18:11:33 +0100 Subject: [PATCH 1/2] write special env variables at the very end of the installer (e.g. SESSION_DRIVER) --- app/Filament/Pages/Installer/PanelInstaller.php | 3 +++ app/Filament/Pages/Installer/Steps/EnvironmentStep.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Filament/Pages/Installer/PanelInstaller.php b/app/Filament/Pages/Installer/PanelInstaller.php index fba27eade8..8ea3e2bad7 100644 --- a/app/Filament/Pages/Installer/PanelInstaller.php +++ b/app/Filament/Pages/Installer/PanelInstaller.php @@ -104,6 +104,9 @@ public function submit(): Redirector|RedirectResponse $this->user ??= User::all()->filter(fn ($user) => $user->isRootAdmin())->first(); auth()->guard()->login($this->user, true); + // Special handling for special env variables (looking at you, SESSION_DRIVER) + $this->writeToEnv('env_special'); + // Redirect to admin panel return redirect(Dashboard::getUrl()); } diff --git a/app/Filament/Pages/Installer/Steps/EnvironmentStep.php b/app/Filament/Pages/Installer/Steps/EnvironmentStep.php index 5df2ecd40a..2751fa464a 100644 --- a/app/Filament/Pages/Installer/Steps/EnvironmentStep.php +++ b/app/Filament/Pages/Installer/Steps/EnvironmentStep.php @@ -68,7 +68,7 @@ public static function make(PanelInstaller $installer): Step ->inline() ->options(self::CACHE_DRIVERS) ->default(config('cache.default', 'file')), - ToggleButtons::make('env_general.SESSION_DRIVER') + ToggleButtons::make('env_special.SESSION_DRIVER') ->label('Session Driver') ->hintIcon('tabler-question-mark') ->hintIconTooltip('The driver used for storing sessions. We recommend "Filesystem" or "Database".') From 6660dd9cf6cf1aa352749da5aa15b8a02d8b1c47 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Fri, 1 Nov 2024 19:02:18 +0100 Subject: [PATCH 2/2] fix hidden check --- app/Filament/Pages/Installer/PanelInstaller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Pages/Installer/PanelInstaller.php b/app/Filament/Pages/Installer/PanelInstaller.php index 8ea3e2bad7..2302f6a701 100644 --- a/app/Filament/Pages/Installer/PanelInstaller.php +++ b/app/Filament/Pages/Installer/PanelInstaller.php @@ -71,7 +71,7 @@ protected function getFormSchema(): array EnvironmentStep::make($this), DatabaseStep::make($this), RedisStep::make($this) - ->hidden(fn (Get $get) => $get('env_general.SESSION_DRIVER') != 'redis' && $get('env_general.QUEUE_CONNECTION') != 'redis' && $get('env_general.CACHE_STORE') != 'redis'), + ->hidden(fn (Get $get) => $get('env_special.SESSION_DRIVER') != 'redis' && $get('env_general.QUEUE_CONNECTION') != 'redis' && $get('env_general.CACHE_STORE') != 'redis'), AdminUserStep::make($this), CompletedStep::make(), ])