diff --git a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php index 96679dc9..f3dd204a 100644 --- a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php +++ b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php @@ -40,9 +40,17 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper $this->app['cache']->forgetDriver($this->storeName); - //This is important because the Cache Repository is using an old version of the CacheManager + // The CacheManager will have the $app['config'] array cached with old prefixes on the 'cache' instance + $this->app->forgetInstance('cache'); + + // The Cache Repository is using an old version of the CacheManager so we need to forget it $this->app->forgetInstance('cache.store'); + // Forget the cache repository in the container + $this->app->forgetInstance(Repository::class); + + // 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(); } }