1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 18:04:03 +00:00
tenancy/tests/Etc/SpecificCacheStoreService.php
2023-01-06 07:17:55 +01:00

27 lines
596 B
PHP

<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests\Etc;
use Illuminate\Cache\CacheManager;
use Illuminate\Cache\Repository;
class SpecificCacheStoreService
{
public Repository $cache;
public function __construct(CacheManager $cacheManager, string $cacheStoreName)
{
$this->cache = $cacheManager->store($cacheStoreName);
}
public function handle(): void
{
if (tenancy()->initialized) {
$this->cache->put('key', tenant()->getTenantKey());
} else {
$this->cache->put('key', 'central-value');
}
}
}