check(); } /** * Prepare the data for validation. * @return void */ protected function prepareForValidation(): void { $this->mergePicture('logo'); $this->merge([ 'key' => Str::slug($this->key), ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $user = auth('backend')->user(); $rules = [ 'key' => 'required|string|max:45|unique:App\Models\Url,key', 'value' => 'required|url:http,https|max:255', 'title' => 'required|string|min:3|max:255', 'brand_id' => [ 'required', 'integer', 'exists:App\Models\Brand,id', !$user->role->equals(RoleEnum::conceptor) ? Rule::in($user->brands->pluck('id')) : '' ], 'image_settings' => 'required|json', ]; return \array_merge( $rules, $this->pictureRulesWithSvgSupport('logo', 100, 100, 500, 500, true), ); } }