mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-14 04:14:05 +00:00
Hint Repository implementation instead of contract
This commit is contained in:
parent
bd6332f0e6
commit
cc9928bc34
1 changed files with 7 additions and 3 deletions
|
|
@ -5,7 +5,8 @@ declare(strict_types=1);
|
||||||
namespace Stancl\Tenancy\Bootstrappers;
|
namespace Stancl\Tenancy\Bootstrappers;
|
||||||
|
|
||||||
use Illuminate\Cache\CacheManager;
|
use Illuminate\Cache\CacheManager;
|
||||||
use Illuminate\Contracts\Config\Repository;
|
use Illuminate\Cache\Repository;
|
||||||
|
use Illuminate\Contracts\Config\Repository as RepositoryContract;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
||||||
use Stancl\Tenancy\Contracts\Tenant;
|
use Stancl\Tenancy\Contracts\Tenant;
|
||||||
|
|
@ -17,7 +18,7 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper
|
||||||
public static array $tenantCacheStores = [];
|
public static array $tenantCacheStores = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Repository $config,
|
protected RepositoryContract $config,
|
||||||
protected CacheManager $cacheManager,
|
protected CacheManager $cacheManager,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +45,10 @@ class PrefixCacheTenancyBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
$newStore = $this->cacheManager->resolve($this->storeName ?? $this->cacheManager->getDefaultDriver())->getStore();
|
$newStore = $this->cacheManager->resolve($this->storeName ?? $this->cacheManager->getDefaultDriver())->getStore();
|
||||||
|
|
||||||
$this->cacheManager->driver($this->storeName)->setStore($newStore);
|
/** @var Repository $repository */
|
||||||
|
$repository = $this->cacheManager->driver($this->storeName);
|
||||||
|
|
||||||
|
$repository->setStore($newStore);
|
||||||
|
|
||||||
// It is needed when a call to the facade has been made before bootstrapping tenancy
|
// 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
|
// The facade has its own cache, separate from the container
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue