Completed
Push — master ( 8f800b...a10bf5 )
by Biao
03:46
created

DatabaseServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 19 1
1
<?php
2
3
namespace Hhxsv5\LaravelS\Illuminate\Database;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\DatabaseServiceProvider as IlluminateDatabaseServiceProvider;
7
8
class DatabaseServiceProvider extends IlluminateDatabaseServiceProvider
9
{
10
    public function register()
11
    {
12
        Model::clearBootedModels();
13
14
        $this->registerEloquentFactory();
15
16
        $this->registerQueueableEntityResolver();
17
18
19
        $this->app->singleton('db.factory', function ($app) {
20
            return new ConnectionFactory($app);
21
        });
22
23
        $this->app->singleton('db', function ($app) {
24
            return new DatabaseManager($app, $app['db.factory']);
25
        });
26
27
        $this->app->bind('db.connection', function ($app) {
28
            return $app['db']->connection();
29
        });
30
    }
31
}