mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 02:54:05 +00:00
Make DB storage driver prefix sqlite DBs with database_path()
This commit is contained in:
parent
f87c2b69ec
commit
5edf582269
2 changed files with 17 additions and 3 deletions
|
|
@ -89,9 +89,11 @@ final class DatabaseManager
|
|||
}
|
||||
}
|
||||
|
||||
public function getDriver(): ?string
|
||||
public function getDriver($connectionName = null): ?string
|
||||
{
|
||||
return config('database.connections.tenant.driver');
|
||||
$connectionName = $connectionName ?: $this->defaultTenantConnectionName;
|
||||
|
||||
return config("database.connections.$connectionName.driver");
|
||||
}
|
||||
|
||||
public function createTenantConnection(string $databaseName, string $connectionName = null)
|
||||
|
|
@ -105,7 +107,7 @@ final class DatabaseManager
|
|||
]);
|
||||
|
||||
// Change DB name
|
||||
$databaseName = $this->getDriver() === 'sqlite' ? database_path($databaseName) : $databaseName;
|
||||
$databaseName = $this->getDriver($connectionName) === 'sqlite' ? database_path($databaseName) : $databaseName;
|
||||
config()->set(["database.connections.$connectionName.database" => $databaseName]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue