check(); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { $rules = [ 'h2_title' => 'required|between:3,255', ]; if ($this->route('section')->section !== \app\Enums\Sections\PageSectionEnum::hire_grow) { $rules = \array_merge($rules, [ 'text' => 'present', ]); } if ($this->route('section')->section->containsData()) { $rules = \array_merge($rules, [ 'data' => 'present|array', 'data.*' => 'required|array', ]); } return \array_merge( parent::rules(), $rules ); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'h2_title' => __('validation.custom.h2_title'), 'text' => __('validation.attributes.content'), 'data' => trans('Valeurs du contenu spécifique'), 'data.*.value' => trans('Valeur du contenu spécifique'), ]; } }