ConnectionResolver
in package
implements
ConnectionResolverInterface
Interfaces, Classes and Traits
Table of Contents
- $connections : array<string|int, mixed>
- All of the registered connections.
- $default : string
- The default connection name.
- __construct() : void
- Create a new connection resolver instance.
- addConnection() : void
- Add a connection to the resolver.
- connection() : ConnectionInterface
- Get a database connection instance.
- getDefaultConnection() : string
- Get the default connection name.
- hasConnection() : bool
- Check if a connection has been registered.
- setDefaultConnection() : void
- Set the default connection name.
Properties
$connections
All of the registered connections.
protected
array<string|int, mixed>
$connections
= []
$default
The default connection name.
protected
string
$default
Methods
__construct()
Create a new connection resolver instance.
public
__construct([array<string|int, mixed> $connections = [] ]) : void
Parameters
- $connections : array<string|int, mixed> = []
Return values
void —addConnection()
Add a connection to the resolver.
public
addConnection(string $name, ConnectionInterface $connection) : void
Parameters
- $name : string
- $connection : ConnectionInterface
Return values
void —connection()
Get a database connection instance.
public
connection([string $name = null ]) : ConnectionInterface
Parameters
- $name : string = null
Return values
ConnectionInterface —getDefaultConnection()
Get the default connection name.
public
getDefaultConnection() : string
Return values
string —hasConnection()
Check if a connection has been registered.
public
hasConnection(string $name) : bool
Parameters
- $name : string
Return values
bool —setDefaultConnection()
Set the default connection name.
public
setDefaultConnection(string $name) : void
Parameters
- $name : string