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

updateTenant DB storage driver

This commit is contained in:
Samuel Štancl 2019-09-18 18:11:41 +02:00
parent 3b72a97527
commit 1f88a1ff94
2 changed files with 8 additions and 2 deletions

View file

@ -85,7 +85,12 @@ class DatabaseStorageDriver implements StorageDriver
public function updateTenant(Tenant $tenant): void
{
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

View file

@ -10,7 +10,8 @@ use Stancl\Tenancy\Contracts\StorageDriver;
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
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.