From 4fdbbff74b0ee848105d85beebd2a33b33ad0816 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 28 Apr 2026 09:35:19 +0200 Subject: [PATCH] Correctly store falsy startup variable values (#2305) --- app/Filament/Components/Forms/Fields/StartupVariable.php | 4 ++-- app/Filament/Server/Pages/Startup.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Filament/Components/Forms/Fields/StartupVariable.php b/app/Filament/Components/Forms/Fields/StartupVariable.php index 6d277fa07..61710a1d2 100644 --- a/app/Filament/Components/Forms/Fields/StartupVariable.php +++ b/app/Filament/Components/Forms/Fields/StartupVariable.php @@ -49,7 +49,7 @@ class StartupVariable extends Field $this->hintIcon(TablerIcon::Code, fn (StartupVariable $component) => implode('|', $component->getVariableRules())); - $this->helperText(fn (StartupVariable $component) => !$component->getVariableDesc() ? '—' : $component->getVariableDesc()); + $this->helperText(fn (StartupVariable $component) => $component->getVariableDesc()); $this->rules(fn (StartupVariable $component) => $component->getVariableRules()); @@ -70,7 +70,7 @@ class StartupVariable extends Field ], StartupVariableType::Toggle => [ ...parent::getDefaultStateCasts(), - new BooleanStateCast(false), + new BooleanStateCast(false, true), ], default => parent::getDefaultStateCasts() }; diff --git a/app/Filament/Server/Pages/Startup.php b/app/Filament/Server/Pages/Startup.php index 8de8f688c..b9be624e0 100644 --- a/app/Filament/Server/Pages/Startup.php +++ b/app/Filament/Server/Pages/Startup.php @@ -149,12 +149,16 @@ class Startup extends ServerFormPage return parent::canAccess() && user()?->can(SubuserPermission::StartupRead, Filament::getTenant()); } - public function update(?string $state, ServerVariable $serverVariable): void + public function update(null|string|bool $state, ServerVariable $serverVariable): void { if (!$serverVariable->variable->user_editable) { return; } + if (is_bool($state)) { + $state = $state ? '1' : '0'; + } + $original = $serverVariable->variable_value; try {