mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 22:34:03 +00:00
Passing tests with DB storage driver
This commit is contained in:
parent
12c05c0af6
commit
6b0ec1b554
4 changed files with 15 additions and 20 deletions
|
|
@ -59,7 +59,7 @@ class DatabaseStorageDriver implements StorageDriver
|
|||
throw new TenantWithThisIdAlreadyExistsException($tenant->id);
|
||||
}
|
||||
|
||||
if (Domains::whereIn('domain', [$tenant->domains])->exists()) {
|
||||
if (Domains::whereIn('domain', $tenant->domains)->exists()) {
|
||||
throw new DomainOccupiedByOtherTenantException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,12 +203,12 @@ class Tenant implements ArrayAccess
|
|||
|
||||
public function getDatabaseName()
|
||||
{
|
||||
return $this['_tenancy_db_name'] ?? ($this->app['config']['tenancy.database.prefix'] . $this->id . $this->app['config']['tenancy.database.suffix']);
|
||||
return $this->data['_tenancy_db_name'] ?? ($this->app['config']['tenancy.database.prefix'] . $this->id . $this->app['config']['tenancy.database.suffix']);
|
||||
}
|
||||
|
||||
public function getConnectionName()
|
||||
{
|
||||
return $this['_tenancy_db_connection'] ?? 'tenant';
|
||||
return $this->data['_tenancy_db_connection'] ?? 'tenant';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ class TenantManager
|
|||
return $this;
|
||||
}
|
||||
|
||||
public static function create($domains, array $data = []): Tenant
|
||||
{
|
||||
return Tenant::create($domains, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that a tenant can be created.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue