From 50d46139f675d6da3e724c97e1ff797e392a7f31 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 9 Dec 2022 12:21:37 +0100 Subject: [PATCH] Add macro --- src/Bootstrappers/PrefixCacheTenancyBootstrapper.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php index 36433cd7..f8b59946 100644 --- a/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php +++ b/src/Bootstrappers/PrefixCacheTenancyBootstrapper.php @@ -5,10 +5,10 @@ declare(strict_types=1); namespace Stancl\Tenancy\Bootstrappers; use Illuminate\Cache\CacheManager; -use Illuminate\Contracts\Config\Repository; -use Illuminate\Support\Facades\Cache; -use Stancl\Tenancy\Contracts\TenancyBootstrapper; use Stancl\Tenancy\Contracts\Tenant; +use Illuminate\Support\Facades\Cache; +use Illuminate\Contracts\Config\Repository; +use Stancl\Tenancy\Contracts\TenancyBootstrapper; class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper { @@ -23,6 +23,10 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper public function bootstrap(Tenant $tenant): void { + Cache::macro('setStore', function($store) { + $this->store = $store; + }); + $this->originalPrefix = $this->config->get('cache.prefix'); $this->storeName = $this->config->get('cache.default');