resetFacadeCache(); $this->originalCache = $this->originalCache ?? $this->app['cache']; $this->app->extend('cache', function () { return new TenantCacheManager($this->app); }); } public function revert(): void { $this->resetFacadeCache(); $this->app->extend('cache', function () { return $this->originalCache; }); $this->originalCache = null; } /** * This wouldn't be necessary, but is needed when a call to the * facade has been made prior to bootstrapping tenancy. The * facade has its own cache, separate from the container. */ public function resetFacadeCache(): void { Cache::clearResolvedInstances(); } }