options([ 1 => $trueLabel ?? __('filament-forms::components.radio.boolean.true'), 0 => $falseLabel ?? __('filament-forms::components.radio.boolean.false'), ]); $this->stateCast(app(BooleanStateCast::class, ['isStoredAsInt' => true])); return $this; } public function inline(bool | Closure $condition = true): static { $this->isInline = $condition; return $this; } public function isInline(): bool { return (bool) $this->evaluate($this->isInline); } public function getDefaultState(): mixed { $state = parent::getDefaultState(); if (is_bool($state)) { return $state ? 1 : 0; } return $state; } /** * @return array */ public function getDefaultStateCasts(): array { if ($this->hasCustomStateCasts() || filled($this->getEnum())) { return parent::getDefaultStateCasts(); } return [app(StringStateCast::class, ['isNullable' => true])]; } /** * @return ?array */ public function getInValidationRuleValues(): ?array { $values = parent::getInValidationRuleValues(); if ($values !== null) { return $values; } return array_keys($this->getEnabledOptions()); } public function hasNullableBooleanState(): bool { return true; } }