From 7bb86f2347aeaf459e9309996d4337930540e5ce Mon Sep 17 00:00:00 2001 From: Boy132 Date: Fri, 1 Nov 2024 18:11:33 +0100 Subject: [PATCH 1/3] 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/3] 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(), ]) From a359ff34c5f5c6603792ab7d27cc4a6e6aa69855 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Fri, 8 Nov 2024 23:16:46 +0100 Subject: [PATCH 3/3] remove cache forget from migration --- .../2024_07_19_130942_create_permission_tables.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/database/migrations/2024_07_19_130942_create_permission_tables.php b/database/migrations/2024_07_19_130942_create_permission_tables.php index 9c7044b46e..24eb309d27 100644 --- a/database/migrations/2024_07_19_130942_create_permission_tables.php +++ b/database/migrations/2024_07_19_130942_create_permission_tables.php @@ -1,8 +1,8 @@ primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary'); }); - - app('cache') - ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) - ->forget(config('permission.cache.key')); } /**