Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write special env variables at the very end of the installer #699

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/Filament/Pages/Installer/PanelInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
])
Expand Down Expand Up @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Pages/Installer/Steps/EnvironmentStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -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".')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
Expand Down Expand Up @@ -114,10 +114,6 @@ public function up(): void

$table->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'));
}

/**
Expand Down
Loading