check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation(): void { $this->merge([ 'slug' => Str::slug(strip_tags($this->label)) ]); $this->mergePicture('picture'); $this->mergePicture('picture_banner'); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { $rules = [ 'label' => 'required|min:3|max:255', 'seo_title' => 'required|min:45|max:70', 'seo_description' => 'required|min:50|max:160', 'color' => 'required|color_rgba', 'picture_alt' => 'required|min:3|max:255', 'picture_title' => 'required|min:3|max:255', 'picture_banner_alt' => 'required|min:3|max:255', 'picture_banner_title' => 'required|min:3|max:255', ]; return \array_merge( $rules, $this->pictureRules('picture', 290, 232, 290, 232, true), $this->pictureRules('picture_banner', 1440, 300, 1440, 300, true), ); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'label' => trans('label'), 'slug' => trans('slug'), 'seo_title' => trans('title') . ' seo', 'seo_description' => trans('description') . ' seo', 'color' => trans('couleur'), 'picture' => trans('Illustration'), 'picture_alt' => trans('attribut alt de l\'image'), 'picture_title' => trans('titre de l\'image'), 'picture_banner' => trans('bannière'), 'picture_banner_alt' => trans('attribut alt de la bannière'), 'picture_banner_title' => trans('titre de la bannière'), ]; } }