mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 04:04:04 +00:00
Change default tenant model, write more tests, cleanup
This commit is contained in:
parent
c32f229dd5
commit
de53b81c0e
33 changed files with 210 additions and 90 deletions
|
|
@ -4,16 +4,17 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use Stancl\Tenancy\Contracts\ManagesDatabaseUsers;
|
||||
use Stancl\Tenancy\Contracts\TenantDatabaseManager;
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\Exceptions\DatabaseManagerNotRegisteredException;
|
||||
use Stancl\Tenancy\Contracts\TenantWithDatabase as Tenant;
|
||||
|
||||
class DatabaseConfig
|
||||
{
|
||||
/** @var Tenant */
|
||||
/** @var Tenant|Model */
|
||||
public $tenant;
|
||||
|
||||
/** @var callable */
|
||||
|
|
@ -90,6 +91,10 @@ class DatabaseConfig
|
|||
$this->tenant->setInternal('db_username', $this->getUsername() ?? (static::$usernameGenerator)($this->tenant));
|
||||
$this->tenant->setInternal('db_password', $this->getPassword() ?? (static::$passwordGenerator)($this->tenant));
|
||||
}
|
||||
|
||||
if ($this->tenant->exists) {
|
||||
$this->tenant->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function getTemplateConnectionName(): string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue