mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 00:14:04 +00:00
Add test
This commit is contained in:
parent
8a54e19644
commit
a59d5a1069
2 changed files with 68 additions and 0 deletions
27
tests/Etc/CacheManagerService.php
Normal file
27
tests/Etc/CacheManagerService.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Tests\Etc;
|
||||
|
||||
use Illuminate\Cache\CacheManager;
|
||||
use Illuminate\Cache\Repository;
|
||||
|
||||
class CacheManagerService
|
||||
{
|
||||
public Repository|null $cache = null;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue