mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:14:03 +00:00
Resolver refactor, path identification improvements (#41)
* resolver refactor * Fix code style (php-cs-fixer) * make tenant column used in PathTenantResolver configurable, fix phpstan errors, minor improvements * support binding route fields, write tests for customizable tenant columns * Invalidate cache for all possible columns in path resolver * implement proper cache separation logic for different columns used by PathTenantResolver * improve return type --------- Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
parent
dc430666ba
commit
0c11f29c19
17 changed files with 370 additions and 88 deletions
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Database\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Resolvers\Contracts\CachedTenantResolver;
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
|
@ -12,7 +13,7 @@ trait InvalidatesResolverCache
|
|||
{
|
||||
public static function bootInvalidatesResolverCache(): void
|
||||
{
|
||||
static::saved(function (Tenant $tenant) {
|
||||
static::saved(function (Tenant&Model $tenant) {
|
||||
foreach (Tenancy::cachedResolvers() as $resolver) {
|
||||
/** @var CachedTenantResolver $resolver */
|
||||
$resolver = app($resolver);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue