originalPrefix = $this->config->get('cache.prefix'); $this->storeName = $this->config->get('cache.default'); if (in_array($this->storeName, static::$tenantCacheStores)) { $this->setCachePrefix($this->originalPrefix . $this->config->get('tenancy.cache.prefix_base') . $tenant->getTenantKey()); } } public function revert(): void { $this->setCachePrefix($this->originalPrefix); $this->originalPrefix = null; } protected function setCachePrefix(string|null $prefix): void { $this->config->set('cache.prefix', $prefix); $this->cacheManager->refreshStore(); // It is needed when a call to the facade has been made before bootstrapping tenancy // The facade has its own cache, separate from the container Cache::clearResolvedInstances(); } }