1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-14 11:54:04 +00:00

Change default tenant model, write more tests, cleanup

This commit is contained in:
Samuel Štancl 2020-05-13 06:23:41 +02:00
parent c32f229dd5
commit de53b81c0e
33 changed files with 210 additions and 90 deletions

View file

@ -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\DatabaseManager;
use Stancl\Tenancy\Events\DatabaseCreated;
class CreateDatabase implements ShouldQueue
@ -26,9 +27,10 @@ class CreateDatabase implements ShouldQueue
$this->tenant = $tenant;
}
public function handle()
public function handle(DatabaseManager $databaseManager)
{
if ($this->tenant->getInternal('create_database') !== false) {
$databaseManager->ensureTenantCanBeCreated($this->tenant);
$this->tenant->database()->makeCredentials();
$this->tenant->database()->manager()->createDatabase($this->tenant);