check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation(): void { $this->mergePicture('part3_picture'); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { $rules = [ 'seo_title' => 'required|min:3|max:70', 'seo_description' => 'required|min:50|max:160', 'part1_title' => 'required|min:3|max:70', 'part1_subtitle' => 'required|min:3|max:70', 'part1_text_1' => 'required|string|min:15', 'part1_text_2' => 'required|string|min:15', 'part1_text_3' => 'required|string|min:15', 'part2_title' => 'required|min:3|max:70', 'part2_subtitle' => 'required|min:3|max:70', 'part2_text' => 'required|string|min:15', 'part2_list' => 'present|array', 'part2_list.*' => 'required|array', 'part2_list.*.value' => 'required|string|min:3|max:255', 'part2_product1_id' => 'required|exists:products,id', 'part2_product2_id' => 'required|exists:products,id', 'part3_picture_alt' => 'required|min:3|max:255', 'part3_picture_title' => 'required|min:3|max:255', ]; return \array_merge( $rules, $this->pictureRules('part3_picture', 2048, 1366, 2048, 1366, true), ); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'seo_title' => trans('titre') . ' seo', 'seo_description' => trans('description') . ' seo', 'part1_title' => trans('title part.1'), 'part1_subtitle' => trans('subtitle part.1'), 'part1_text_1' => trans('text 1 part.1'), 'part1_text_2' => trans('text 2 part.1'), 'part1_text_3' => trans('text 3 part.1'), 'part2_title' => trans('title part.2'), 'part2_subtitle' => trans('subtitle part.2'), 'part2_text' => trans('text part.2'), 'part2_list' => trans('values of the list part.2'), 'part2_list.*.value' => trans('value of the list part.2'), 'part2_product1_id' => trans('value of the first product part.2'), 'part2_product2_id' => trans('value of the second product part.2'), 'part3_picture' => trans('illustration'), 'part3_picture_alt' => trans('alt attribute of the image'), 'part3_picture_title' => trans('title attribute of the image'), ]; } }