merge([ 'back_link_display' => $this->back_link_display ? 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|string|min:2|max:28', 'slug' => 'required|unique:sub_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_display' => 'required|boolean', 'back_link_url' => [ 'nullable', 'url', // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed function ($attribute, $value, $fail) { try { Utils::assertNoInternalUrls('Url du lien', $value); } catch (ValidationException $e) { $fail(collect($e->errors())->first()[0]); } } ], 'back_link_text' => 'nullable|string|min:2|max:20', ]; } }