mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 19:04:04 +00:00
move event() calls
This commit is contained in:
parent
5a045b4dcd
commit
c100d90e67
1 changed files with 6 additions and 3 deletions
|
|
@ -30,8 +30,6 @@ class DeleteDatabase implements ShouldQueue
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
event(new DeletingDatabase($this->tenant));
|
|
||||||
|
|
||||||
if (static::$skipWhenCreateDatabaseIsFalse && $this->tenant->getInternal('create_database') === false) {
|
if (static::$skipWhenCreateDatabaseIsFalse && $this->tenant->getInternal('create_database') === false) {
|
||||||
// If database creation was skipped, we presume deletion should also be skipped.
|
// If database creation was skipped, we presume deletion should also be skipped.
|
||||||
// To avoid this skip, either unset the `create_database` attribute (or make it true), or
|
// To avoid this skip, either unset the `create_database` attribute (or make it true), or
|
||||||
|
|
@ -39,14 +37,19 @@ class DeleteDatabase implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event(new DeletingDatabase($this->tenant));
|
||||||
|
|
||||||
|
$deleted = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->tenant->database()->manager()->deleteDatabase($this->tenant);
|
$this->tenant->database()->manager()->deleteDatabase($this->tenant);
|
||||||
|
$deleted = true;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
if (! static::$ignoreFailures) {
|
if (! static::$ignoreFailures) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new DatabaseDeleted($this->tenant));
|
if ($deleted) event(new DatabaseDeleted($this->tenant));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue