mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 00:34:03 +00:00
Move Cache::macro() to a slightly more appropriate place
This commit is contained in:
parent
d3c7fef002
commit
35a3412011
2 changed files with 5 additions and 4 deletions
|
|
@ -23,10 +23,6 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
public function bootstrap(Tenant $tenant): void
|
public function bootstrap(Tenant $tenant): void
|
||||||
{
|
{
|
||||||
Cache::macro('setStore', function ($store) {
|
|
||||||
$this->store = $store;
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->originalPrefix = $this->config->get('cache.prefix');
|
$this->originalPrefix = $this->config->get('cache.prefix');
|
||||||
$this->storeName = $this->config->get('cache.default');
|
$this->storeName = $this->config->get('cache.default');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy;
|
namespace Stancl\Tenancy;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Cache\CacheManager as BaseCacheManager;
|
use Illuminate\Cache\CacheManager as BaseCacheManager;
|
||||||
|
|
||||||
// todo move to Cache namespace?
|
// todo move to Cache namespace?
|
||||||
|
|
@ -43,6 +44,10 @@ class CacheManager extends BaseCacheManager
|
||||||
|
|
||||||
public function refreshStore(string|null $repository = null): void
|
public function refreshStore(string|null $repository = null): void
|
||||||
{
|
{
|
||||||
|
Cache::macro('setStore', function ($store) {
|
||||||
|
$this->store = $store;
|
||||||
|
});
|
||||||
|
|
||||||
$newStore = $this->resolve($repository ?? $this->getDefaultDriver())->getStore();
|
$newStore = $this->resolve($repository ?? $this->getDefaultDriver())->getStore();
|
||||||
|
|
||||||
$this->driver($repository)->setStore($newStore);
|
$this->driver($repository)->setStore($newStore);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue