1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 02:44:02 +00:00

Move logic from separate method to __call

This commit is contained in:
lukinovec 2023-04-12 07:21:33 +02:00
parent 2d0ee2c7cd
commit 940fb1744b

View file

@ -21,14 +21,6 @@ class CacheManager extends BaseCacheManager
public function __call($method, $parameters) public function __call($method, $parameters)
{ {
if (tenancy()->initialized && static::$addTags) { if (tenancy()->initialized && static::$addTags) {
return $this->callWithTag($method, $parameters);
}
return parent::__call($method, $parameters);
}
protected function callWithTag($method, $parameters)
{
$tags = [config('tenancy.cache.tag_base') . tenant()?->getTenantKey()]; $tags = [config('tenancy.cache.tag_base') . tenant()?->getTenantKey()];
if ($method === 'tags') { if ($method === 'tags') {
@ -46,4 +38,7 @@ class CacheManager extends BaseCacheManager
return $this->store()->tags($tags)->$method(...$parameters); return $this->store()->tags($tags)->$method(...$parameters);
} }
return parent::__call($method, $parameters);
}
} }