mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 03:34:04 +00:00
updateTenant DB storage driver
This commit is contained in:
parent
3b72a97527
commit
1f88a1ff94
2 changed files with 8 additions and 2 deletions
|
|
@ -85,7 +85,12 @@ class DatabaseStorageDriver implements StorageDriver
|
||||||
public function updateTenant(Tenant $tenant): void
|
public function updateTenant(Tenant $tenant): void
|
||||||
{
|
{
|
||||||
Tenants::find($tenant->id)->putMany($tenant->data);
|
Tenants::find($tenant->id)->putMany($tenant->data);
|
||||||
// todo1 update domains
|
Domains::firstOrCreate(array_map(function ($domain) use ($tenant) {
|
||||||
|
return [
|
||||||
|
'tenant_id' => $tenant->id,
|
||||||
|
'domain' => $domain,
|
||||||
|
];
|
||||||
|
}, $tenant->domains));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteTenant(Tenant $tenant): void
|
public function deleteTenant(Tenant $tenant): void
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ use Stancl\Tenancy\Contracts\StorageDriver;
|
||||||
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||||
use Stancl\Tenancy\Exceptions\TenantStorageException;
|
use Stancl\Tenancy\Exceptions\TenantStorageException;
|
||||||
|
|
||||||
// todo write tests for updating the tenant
|
// todo2 write tests for updating the tenant
|
||||||
|
// todo2 addDomain(), removeDomain()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal Class is subject to breaking changes in minor and patch versions.
|
* @internal Class is subject to breaking changes in minor and patch versions.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue