mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 00:14:04 +00:00
CacheManager dependency injection test
This commit is contained in:
parent
70ee83b3b7
commit
222686ec1d
3 changed files with 42 additions and 1 deletions
24
tests/Etc/CacheAction.php
Normal file
24
tests/Etc/CacheAction.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Tests\Etc;
|
||||
|
||||
use Illuminate\Cache\CacheManager;
|
||||
|
||||
class CacheAction
|
||||
{
|
||||
public function __construct(
|
||||
protected CacheManager $cache
|
||||
){
|
||||
}
|
||||
|
||||
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