Total Complexity | 3 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | class DatabaseServiceProvider extends AbstractServiceProvider |
||
14 | { |
||
15 | /** |
||
16 | * Register the service provider. |
||
17 | * |
||
18 | * @return void |
||
19 | */ |
||
20 | public function register() |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Register the primary database bindings. |
||
27 | * |
||
28 | * @return void |
||
29 | */ |
||
30 | protected function registerConnectionServices() |
||
31 | { |
||
32 | // The connection factory is used to create the actual connection instances on |
||
33 | // the database. We will inject the factory into the manager so that it may |
||
34 | // make the connections while they are actually needed and not of before. |
||
35 | $this->getContainer()->share('db.factory', ConnectionFactory::class); |
||
36 | |||
37 | // The database manager is used to resolve various connections, since multiple |
||
38 | // connections might be managed. It also implements the connection resolver |
||
39 | // interface which may be used by other components requiring connections. |
||
40 | $this->getContainer()->share('db', DatabaseManager::class); |
||
41 | |||
42 | $this->getContainer()->share('db.connection', function () { |
||
43 | return app('db')->connection(); |
||
44 | }); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @inheritdoc |
||
49 | */ |
||
50 | public function provides() |
||
53 | } |
||
54 | } |
||
55 |