ConnectionFactory
class ConnectionFactory (View source)
Properties
protected Container | $container | The IoC container instance. |
Methods
void | __construct(Container $container) Create a new connection factory instance. | |
Connection | make(array $config, string|null $name = null) Establish a PDO connection based on the configuration. | |
array | parseConfig(array $config, string $name) Parse and prepare the database configuration. | |
Connection | createSingleConnection(array $config) Create a single database connection instance. | |
Connection | createReadWriteConnection(array $config) Create a single database connection instance. | |
Closure | createReadPdo(array $config) Create a new PDO instance for reading. | |
array | getReadConfig(array $config) Get the read configuration for a read / write connection. | |
array | getWriteConfig(array $config) Get the read configuration for a read / write connection. | |
array | getReadWriteConfig(array $config, string $type) Get a read / write level configuration. | |
array | mergeReadWriteConfig(array $config, array $merge) Merge a configuration for a read / write connection. | |
Closure | createPdoResolver(array $config) Create a new Closure that resolves to a PDO instance. | |
Closure | createPdoResolverWithHosts(array $config) Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts. | |
array | parseHosts(array $config) Parse the hosts configuration item into an array. | |
Closure | createPdoResolverWithoutHosts(array $config) Create a new Closure that resolves to a PDO instance where there is no configured host. | |
ConnectorInterface | createConnector(array $config) Create a connector instance based on the configuration. | |
Connection | createConnection(string $driver, PDO|Closure $connection, string $database, string $prefix = '', array $config = []) Create a new connection instance. |
Details
void __construct(Container $container)
Create a new connection factory instance.
Connection make(array $config, string|null $name = null)
Establish a PDO connection based on the configuration.
protected array parseConfig(array $config, string $name)
Parse and prepare the database configuration.
protected Connection createSingleConnection(array $config)
Create a single database connection instance.
protected Connection createReadWriteConnection(array $config)
Create a single database connection instance.
protected Closure createReadPdo(array $config)
Create a new PDO instance for reading.
protected array getReadConfig(array $config)
Get the read configuration for a read / write connection.
protected array getWriteConfig(array $config)
Get the read configuration for a read / write connection.
protected array getReadWriteConfig(array $config, string $type)
Get a read / write level configuration.
protected array mergeReadWriteConfig(array $config, array $merge)
Merge a configuration for a read / write connection.
protected Closure createPdoResolver(array $config)
Create a new Closure that resolves to a PDO instance.
protected Closure createPdoResolverWithHosts(array $config)
Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts.
protected array parseHosts(array $config)
Parse the hosts configuration item into an array.
protected Closure createPdoResolverWithoutHosts(array $config)
Create a new Closure that resolves to a PDO instance where there is no configured host.
ConnectorInterface createConnector(array $config)
Create a connector instance based on the configuration.
protected Connection createConnection(string $driver, PDO|Closure $connection, string $database, string $prefix = '', array $config = [])
Create a new connection instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/6.x/Illuminate/Database/Connectors/ConnectionFactory.html