mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-15 05:24:04 +00:00
Refactor more old code and get tests to pass
This commit is contained in:
parent
c5377a16f7
commit
c32f229dd5
72 changed files with 425 additions and 531 deletions
|
|
@ -12,6 +12,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||
use Illuminate\Queue\SerializesModels;
|
||||
use Stancl\Tenancy\Contracts\TenantWithDatabase;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Events\DatabaseCreated;
|
||||
|
||||
class CreateDatabase implements ShouldQueue
|
||||
{
|
||||
|
|
@ -30,6 +31,8 @@ class CreateDatabase implements ShouldQueue
|
|||
if ($this->tenant->getInternal('create_database') !== false) {
|
||||
$this->tenant->database()->makeCredentials();
|
||||
$this->tenant->database()->manager()->createDatabase($this->tenant);
|
||||
|
||||
event(new DatabaseCreated($this->tenant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||
use Illuminate\Queue\SerializesModels;
|
||||
use Stancl\Tenancy\Contracts\TenantDatabaseManager;
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Events\DatabaseDeleted;
|
||||
|
||||
class DeleteDatabase implements ShouldQueue
|
||||
{
|
||||
|
|
@ -27,5 +28,7 @@ class DeleteDatabase implements ShouldQueue
|
|||
public function handle()
|
||||
{
|
||||
$this->tenant->database()->manager()->deleteDatabase($this->tenant);
|
||||
|
||||
event(new DatabaseDeleted($this->tenant));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,8 @@ class MigrateDatabase implements ShouldQueue
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$migrationParameters = [
|
||||
// todo ...
|
||||
];
|
||||
|
||||
Artisan::call('tenants:migrate', [
|
||||
'--tenants' => [$this->tenant->id],
|
||||
] + $migrationParameters);
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue