class ConnectionResolver implements ConnectionResolverInterface

Properties

protected array $connections

All of the registered connections.

protected string $default

The default connection name.

Methods

void
__construct(array $connections = [])

Create a new connection resolver instance.

connection(string $name = null)

Get a database connection instance.

void
addConnection(string $name, ConnectionInterface $connection)

Add a connection to the resolver.

bool
hasConnection(string $name)

Check if a connection has been registered.

string
getDefaultConnection()

Get the default connection name.

void
setDefaultConnection(string $name)

Set the default connection name.

Details

at line 27
void __construct(array $connections = [])

Create a new connection resolver instance.

Parameters

array $connections

Return Value

void

at line 40
ConnectionInterface connection(string $name = null)

Get a database connection instance.

Parameters

string $name

Return Value

ConnectionInterface

at line 56
void addConnection(string $name, ConnectionInterface $connection)

Add a connection to the resolver.

Parameters

string $name
ConnectionInterface $connection

Return Value

void

at line 67
bool hasConnection(string $name)

Check if a connection has been registered.

Parameters

string $name

Return Value

bool

at line 77
string getDefaultConnection()

Get the default connection name.

Return Value

string

at line 88
void setDefaultConnection(string $name)

Set the default connection name.

Parameters

string $name

Return Value

void