merge([ 'status' => $this->status ? true : false, 'slug' => Str::slug($this->name) ]); return \auth()->check(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'name' => 'required|max:50', 'slug' => 'required|unique:ranges,slug', 'description' => 'required|max:255', 'picture' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=640,height=564', 'picture_r' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:width=1366,height=563', 'color' => [ 'required', 'max:20', new EnumIsValidRule(RangeColor::class) ] ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'name' => 'Nom', 'slug' => 'Nom', 'description' => 'Description', 'picture' => 'Image', 'picture_r' => 'Image bannière', 'color' => 'Couleur', 'status' => 'Publié', 'flagship_product' => 'Produit phare', 'subranges' => 'Sous gammes' ]; } }