['required', 'integer', 'min:0', 'max:100'], 'max_score' => ['required', 'integer', 'min:0', 'max:100', 'gte:min_score'], 'template_text' => ['required', 'string', 'max:5000'], 'is_active' => ['sometimes', 'boolean'], ]; } protected function prepareForValidation(): void { if ($this->has('is_active')) { $this->merge([ 'is_active' => filter_var($this->input('is_active'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ?? $this->input('is_active'), ]); } else { $this->merge(['is_active' => true]); } } }