check(); } /** * Prepare the data for validation. * @return void */ protected function prepareForValidation(): void { $settings = json_decode($this->image_settings); $settings->image = ""; $this->mergePicture('logo'); $this->merge([ 'key' => Str::slug($this->key), 'image_settings' => json_encode($settings), ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $rules = [ 'key' => 'required|string|max:45|unique:App\Models\Url,key', 'value' => 'required|string|max:255', 'title' => 'required|string|min:3|max:255', 'brand_id' => 'required|integer|exists:App\Models\Brand,id', 'image_settings' => 'required|string', ]; return \array_merge( $rules, $this->pictureRules('logo', false, 100, 100, 500, 500), ); } }