1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 05:24:03 +00:00
tenancy/tests/Etc/CacheManagerService.php
lukinovec 1c21c66913
Make $cache non-nullable
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2023-01-05 11:42:12 +01:00

27 lines
560 B
PHP

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