mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 23:44:03 +00:00
Finish cache invalidation
This commit is contained in:
parent
a6102be1a0
commit
2c1cb92745
3 changed files with 49 additions and 8 deletions
|
|
@ -168,10 +168,17 @@ class DatabaseStorageDriver implements StorageDriver, CanDeleteKeys, CanFindByAn
|
|||
|
||||
public function deleteTenant(Tenant $tenant): void
|
||||
{
|
||||
$originalDomains = $this->domains->getTenantDomains($tenant);
|
||||
|
||||
$this->centralDatabase->transaction(function () use ($tenant) {
|
||||
$this->tenants->where('id', $tenant->id)->delete();
|
||||
$this->domains->where('tenant_id', $tenant->id)->delete();
|
||||
});
|
||||
|
||||
if ($this->usesCache()) {
|
||||
$this->cache->invalidateTenant($tenant->id);
|
||||
$this->cache->invalidateDomainToIdMapping($originalDomains);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue