default(false); $this->rule('boolean'); } public function toEmbeddedHtml(): string { $statePath = $this->getStatePath(); $hasError = $this->hasErrorForPath($statePath); $attributes = (new FilamentComponentAttributeBag) ->merge([ 'autofocus' => $this->isAutofocused(), 'disabled' => $this->isDisabled(), 'id' => $this->getId(), 'required' => $this->isRequired(), 'wire:loading.attr' => 'disabled', $this->applyStateBindingModifiers('wire:model') => $statePath, ], escape: false) ->merge($this->getExtraAttributes(), escape: false) ->merge($this->getExtraInputAttributes(), escape: false) ->class([ 'fi-checkbox-input', 'fi-valid' => ! $hasError, 'fi-invalid' => $hasError, ]); $inputHtml = 'toHtml() . ' />'; if ($this->isInline()) { return $this->wrapEmbeddedHtml( '', labelPrefix: new HtmlString($inputHtml), inlineLabelVerticalAlignment: VerticalAlignment::Center, ); } return $this->wrapEmbeddedHtml( $inputHtml, inlineLabelVerticalAlignment: VerticalAlignment::Center, ); } /** * @return array */ public function getDefaultStateCasts(): array { return [ ...parent::getDefaultStateCasts(), app(BooleanStateCast::class, ['isNullable' => false]), ]; } }