mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 07:14:04 +00:00
add public connection() method to the Tenant DB manager interface
This commit is contained in:
parent
5d688e6e5d
commit
fe0a322b87
6 changed files with 34 additions and 17 deletions
22
src/Database/Contracts/StatefulTenantDatabaseManager.php
Normal file
22
src/Database/Contracts/StatefulTenantDatabaseManager.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\Database\Contracts;
|
||||
|
||||
use Illuminate\Database\Connection;
|
||||
use Stancl\Tenancy\Database\Exceptions\NoConnectionSetException;
|
||||
|
||||
/**
|
||||
* Tenant database manager with a persistent connection.
|
||||
*/
|
||||
interface StatefulTenantDatabaseManager extends TenantDatabaseManager
|
||||
{
|
||||
/** Get the DB connection used by the tenant database manager. */
|
||||
public function database(): Connection; // todo rename to connection()
|
||||
|
||||
/**
|
||||
* Set the DB connection that should be used by the tenant database manager.
|
||||
*
|
||||
* @throws NoConnectionSetException
|
||||
*/
|
||||
public function setConnection(string $connection): void;
|
||||
}
|
||||
|
|
@ -4,8 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Stancl\Tenancy\Database\Contracts;
|
||||
|
||||
use Stancl\Tenancy\Database\Exceptions\NoConnectionSetException;
|
||||
|
||||
interface TenantDatabaseManager
|
||||
{
|
||||
/** Create a database. */
|
||||
|
|
@ -19,11 +17,4 @@ interface TenantDatabaseManager
|
|||
|
||||
/** Construct a DB connection config array. */
|
||||
public function makeConnectionConfig(array $baseConfig, string $databaseName): array;
|
||||
|
||||
/**
|
||||
* Set the DB connection that should be used by the tenant database manager.
|
||||
*
|
||||
* @throws NoConnectionSetException
|
||||
*/
|
||||
public function setConnection(string $connection): void;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue