ConnectionResolver
class ConnectionResolver implements ConnectionResolverInterface (View source)
Properties
| protected ConnectionInterface[] | $connections | All of the registered connections. |
|
| protected string | $default | The default connection name. |
Methods
Create a new connection resolver instance.
Get a database connection instance.
Check if a connection has been registered.
Get the default connection name.
Set the default connection name.
Details
void
__construct(array $connections = [])
Create a new connection resolver instance.
ConnectionInterface
connection(string|null $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.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.