merge([ '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|string|min:2|max:28', 'slug' => 'required|unique:ranges,slug', 'picture' => 'sometimes|image|max:2048|mimes:png,jpg,jpeg|dimensions:height=170,width=170', 'picture_alt' => 'required_with:picture|string|min:10|max:255', 'title' => 'required|string|min:10|max:255', 'subtitle' => 'required|string|min:10|max:255', 'content' => 'required|string|min:20', 'back_link_url' => 'required|url', 'back_link_text' => 'required|string|min:2|max:20', ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'name' => 'Nom', 'slug' => 'Nom', 'title' => 'Titre', 'description' => 'Description', 'picture' => 'Image', 'picture_alt' => 'Texte alternatif d\'image', 'subtitle' => 'Sous titre', 'content' => 'Contenu', 'back_link_url' => 'Url du lien', 'back_link_text' => 'Texte du lien' ]; } }