merge([ 'slug' => Str::slug($this->title), 'parent_gamme_id' => $this->parent_gamme_id === '0' ? null : $this->parent_gamme_id, ]); return auth()->check(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'parent_gamme_id' => 'sometimes|nullable|exists:gammes,id', 'title' => 'required|string|max:255', 'slug' => 'required|unique:gammes', 'text' => 'required|string|max:255', 'color' => 'sometimes', 'picture' => 'required|image|mimes:jpeg,png,jpg|max:1024|dimensions:width=575,height=375', 'alt_text_picture' => 'required|string|max:255', 'banner' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=1920,height=568', 'alt_text_banner' => 'required|string|max:255', ]; } /** * Get custom messages for validator errors. * * @return array */ public function messages() { return []; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'slug' => trans('Nom') ]; } }