authService->check(); } #[\Override] protected function prepareForValidation(): void { $this->merge([ 'repeatable' => $this->boolean('repeatable'), ]); } /** @return array */ public function rules(): array { return [ 'date' => ['required', 'date_format:Y-m-d'], 'label' => ['required', 'string', 'max:255'], 'repeatable' => ['present', 'boolean:strict'], 'repeat_frequency' => ['nullable', 'required_if:repeatable,true', new Enum(RepeatFrequency::class)], ]; } #[\Override] protected function passedValidation(): void { if (! $this->boolean('repeatable')) { $this->merge([ 'repeat_frequency' => RepeatFrequency::WEEKLY->value, ]); } } #[\Override] public function attributes(): array { return [ 'date' => trans('validation.attributes.date'), 'label' => trans('validation.custom.attributes.label'), 'repeatable' => trans('validation.custom.attributes.repeatable'), 'repeat_frequency' => trans('validation.custom.attributes.repeat_frequency'), ]; } }