mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 21:54:02 +00:00
wip
This commit is contained in:
parent
2f3924531d
commit
74fbd816c2
2 changed files with 20 additions and 8 deletions
|
|
@ -126,17 +126,21 @@ class DatabaseManager
|
|||
* Create a database for a tenant.
|
||||
*
|
||||
* @param Tenant $tenant
|
||||
* @param ShouldQueue[]|callable[] $afterCreating
|
||||
* @return void
|
||||
*/
|
||||
public function createDatabase(Tenant $tenant)
|
||||
public function createDatabase(Tenant $tenant, array $afterCreating = [])
|
||||
{
|
||||
$database = $tenant->getDatabaseName();
|
||||
$manager = $this->getTenantDatabaseManager($tenant);
|
||||
|
||||
if ($this->app['config']['tenancy.queue_database_creation'] ?? false) {
|
||||
QueuedTenantDatabaseCreator::dispatch($manager, $database);
|
||||
QueuedTenantDatabaseCreator::withChain($afterCreating)->dispatch($manager, $database);
|
||||
} else {
|
||||
$manager->createDatabase($database);
|
||||
foreach ($afterCreating as $callback) {
|
||||
$callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue