title); $this->merge(['slug' => Str::slug($title)]); $this->mergePicture('banner'); parent::prepareForValidation(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return array_merge( [ 'title' => 'required|min:3|max:255', 'title_simple' => 'required|min:3|max:255', 'slug' => 'required|min:3|max:255', 'seo_title' => 'required|min:53|max:60', 'seo_description' => 'required|min:50|max:160', 'banner_alt' => 'required|nullable|string|min:6|max:255', 'banner_title' => 'required|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('Titre'), 'title_simple' => trans('Titre sans style'), 'seo_title' => trans('Titre') . ' 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') ]; } }