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

Return false from CreateDatabase job

This commit is contained in:
Samuel Štancl 2020-11-12 21:41:09 +01:00
parent dd1b7fc86d
commit f20bb55022

View file

@ -31,12 +31,15 @@ class CreateDatabase implements ShouldQueue
{ {
event(new CreatingDatabase($this->tenant)); event(new CreatingDatabase($this->tenant));
if ($this->tenant->getInternal('create_database') !== false) { // Terminate execution of this job & other jobs in the pipeline
if ($this->tenant->getInternal('create_database') === false) {
return false;
}
$databaseManager->ensureTenantCanBeCreated($this->tenant); $databaseManager->ensureTenantCanBeCreated($this->tenant);
$this->tenant->database()->makeCredentials(); $this->tenant->database()->makeCredentials();
$this->tenant->database()->manager()->createDatabase($this->tenant); $this->tenant->database()->manager()->createDatabase($this->tenant);
event(new DatabaseCreated($this->tenant)); event(new DatabaseCreated($this->tenant));
} }
}
} }