check(); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'slug' => Str::slug($this->name) ]); $this->mergePicture('banner'); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return array_merge( [ 'title' => 'required|min:3|max:255', 'seo_title' => 'required|min:53|max:60', 'seo_description' => 'required|min:50|max:160', 'banner_alt' => 'required_with:banner|nullable|string|min:6|max:255', 'banner_title' => 'required_with:banner|nullable|string|min:6|max:255' ], self::pictureRules('banner', 1920, 340, 1920, 340), parent::rules() ); } /** * Get custom attributes for validator errors. * * @return array */ public function attributes(): array { return [ 'title' => trans('title'), 'seo_title' => trans('title') . ' seo', 'seo_description' => trans('description') . ' seo', 'banner' => trans('bannière'), 'banner_alt' => trans('Texte alternatif de la bannière'), 'banner_title' => trans('Titre de la bannière') ]; } }