1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 19:24:03 +00:00

add public connection() method to the Tenant DB manager interface

This commit is contained in:
Samuel Štancl 2022-10-25 12:53:31 +02:00
parent 5d688e6e5d
commit fe0a322b87
6 changed files with 34 additions and 17 deletions

View file

@ -6,15 +6,15 @@ namespace Stancl\Tenancy\Database\TenantDatabaseManagers;
use Illuminate\Database\Connection;
use Illuminate\Support\Facades\DB;
use Stancl\Tenancy\Database\Contracts\TenantDatabaseManager as Contract;
use Stancl\Tenancy\Database\Contracts\StatefulTenantDatabaseManager;
use Stancl\Tenancy\Database\Exceptions\NoConnectionSetException;
abstract class TenantDatabaseManager implements Contract // todo better naming?
abstract class TenantDatabaseManager implements StatefulTenantDatabaseManager
{
/** The database connection to the server. */
protected string $connection;
protected function database(): Connection
public function database(): Connection
{
if (! isset($this->connection)) {
throw new NoConnectionSetException(static::class);