isChecked = $value === 'true'; } public function render(): string { $data = [ 'id' => $this->value, 'name' => $this->name, 'class' => 'color-radio-btn', ]; if ($this->required) { $data['required'] = 'required'; } $radioInput = form_radio( $data, $this->value, old($this->name) ? old($this->name) === $this->value : $this->isChecked, ); return << {$radioInput} HTML; } }