DatabaseManager
class DatabaseManager implements ConnectionResolverInterface mixin Connection (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected Application | $app | The application instance. |
|
protected ConnectionFactory | $factory | The database connection factory instance. |
|
protected Connection> | $connections | The active connection instances. |
|
protected array<string,array> | $dynamicConnectionConfigurations | The dynamically configured (DB::build) connection configurations. |
|
protected array<string,callable> | $extensions | The custom connection resolvers. |
|
protected callable | $reconnector | The callback to be executed to reconnect to a database. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically pass methods to the default connection.
Get a database connection instance.
Build a database connection instance from the given configuration.
Calculate the dynamic connection name for an on-demand connection based on its configuration.
Get a database connection instance from the given configuration.
Parse the connection into an array of the name and read / write type.
Make the database connection instance.
Get the configuration for a connection.
Dispatch the ConnectionEstablished event if the event dispatcher is available.
Prepare the read / write mode for database connection instance.
Disconnect from the given database and remove from local cache.
Disconnect from the given database.
Reconnect to the given database.
Set the default database connection for the callback execution.
Refresh the PDO connections on a given connection.
Get the default connection name.
Set the default connection name.
Get all of the supported drivers.
Get all of the drivers that are actually available.
Register an extension connection resolver.
Remove an extension connection resolver.
Return all of the created connections.
Set the database reconnector callback.
Details
ConnectionInterface
build(array $config)
Build a database connection instance from the given configuration.
static string
calculateDynamicConnectionName(array $config)
Calculate the dynamic connection name for an on-demand connection based on its configuration.
ConnectionInterface
connectUsing(string $name, array $config, bool $force = false)
Get a database connection instance from the given configuration.
protected array
parseConnectionName(string $name)
Parse the connection into an array of the name and read / write type.
protected Connection
configure(Connection $connection, string $type)
Prepare the database connection instance.
protected void
dispatchConnectionEstablishedEvent(Connection $connection)
Dispatch the ConnectionEstablished event if the event dispatcher is available.
protected Connection
setPdoForType(Connection $connection, string|null $type = null)
Prepare the read / write mode for database connection instance.
void
purge(string|null $name = null)
Disconnect from the given database and remove from local cache.
mixed
usingConnection(string $name, callable $callback)
Set the default database connection for the callback execution.
protected Connection
refreshPdoConnections(string $name)
Refresh the PDO connections on a given connection.