Created
September 19, 2018 15:54
-
-
Save DarkGhostHunter/25e3b2d95ae54e181223915b4b7e59d4 to your computer and use it in GitHub Desktop.
Illuminate\Database\DatabaseServiceProvider@registerConnectionServices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register the primary database bindings. | |
* | |
* @return void | |
*/ | |
protected function registerConnectionServices() | |
{ | |
// The connection factory is used to create the actual connection instances on | |
// the database. We will inject the factory into the manager so that it may | |
// make the connections while they are actually needed and not of before. | |
$this->app->singleton('db.factory', function ($app) { | |
return new ConnectionFactory($app); | |
}); | |
// The database manager is used to resolve various connections, since multiple | |
// connections might be managed. It also implements the connection resolver | |
// interface which may be used by other components requiring connections. | |
$this->app->singleton('db', function ($app) { | |
return new DatabaseManager($app, $app['db.factory']); | |
}); | |
$this->app->bind('db.connection', function ($app) { | |
return $app['db']->connection(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment