mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 19:14:03 +00:00
[4.x] Invalidate resolver cache on delete (#1329)
* Invalidate resolver cache on delete * Fix code style (php-cs-fixer) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
8960a83047
commit
37a0f1a713
3 changed files with 55 additions and 13 deletions
|
|
@ -4,16 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Database\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Tenancy;
|
||||
|
||||
trait InvalidatesResolverCache
|
||||
{
|
||||
public static function bootInvalidatesResolverCache(): void
|
||||
{
|
||||
static::saved(function (Tenant&Model $tenant) {
|
||||
Tenancy::invalidateResolverCache($tenant);
|
||||
});
|
||||
static::saved(Tenancy::invalidateResolverCache(...));
|
||||
static::deleting(Tenancy::invalidateResolverCache(...));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue