route('menu_node_data')); } /** * Prepare the data for validation. * * @return void */ public function prepareForValidation(): void { $this->merge([ 'text' => str($this->input('text'))->value(), 'link_target' => $this->boolean('link_target'), 'link_status' => $this->boolean('link_status'), 'picture_status' => $this->boolean('picture_status'), ]); $this->mergePicture('picture'); $this->mergePicture('background_picture'); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { $rules = [ 'title' => 'required|string|min:4|max:255', 'text' => 'present|string|max:255', 'link_url' => 'string|max:255', 'link_title' => 'required|string|between:3,255', 'link_target' => 'required|boolean', 'link_status' => 'string|boolean', 'picture' => 'string|max:255', 'picture_alt' => 'string|between:3,255', 'picture_title' => 'string|between:3,255', 'picture_status' => 'string|boolean', 'background_picture' => 'string|max:255', 'background_picture_alt' => 'string|between:3,255', 'background_picture_title' => 'string|between:3,255', ]; return \array_merge( $rules, $this->pictureRules('picture', 180, 228, 180, 228), $this->pictureRules('background_picture', 500, 231, 500, 231), ); } }