Completed
Push — master ( 4623fe...be1a12 )
by ARCANEDEV
09:43
created

LaravelAuthServiceProvider::getBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanedev\LaravelAuth;
2
3
use Arcanedev\Support\PackageServiceProvider as ServiceProvider;
4
use Arcanesoft\Contracts\Auth\Models as AuthContracts;
5
6
/**
7
 * Class     LaravelAuthServiceProvider
8
 *
9
 * @package  Arcanedev\LaravelAuth
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class LaravelAuthServiceProvider extends ServiceProvider
13
{
14
    /* -----------------------------------------------------------------
15
     |  Properties
16
     | -----------------------------------------------------------------
17
     */
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'laravel-auth';
24
25
    /* -----------------------------------------------------------------
26
     |  Main Methods
27
     | -----------------------------------------------------------------
28
     */
29
    /**
30
     * Register the service provider.
31
     */
32 234
    public function register()
33
    {
34 234
        $this->registerConfig();
35 234
        $this->bindModels();
36
37 234
        if ($this->config()->get('laravel-auth.observers.enabled', false))
38 234
            $this->registerProvider(Providers\EventServiceProvider::class);
39 234
    }
40
41
    /**
42
     * Boot the service provider.
43
     */
44 234
    public function boot()
45
    {
46 234
        parent::boot();
47
48 234
        $this->publishConfig();
49 234
        $this->publishFactories();
50
51 234
        Auth::$runsMigrations ? $this->loadMigrations() : $this->publishMigrations();
52 234
    }
53
54
    /**
55
     * Get the services provided by the provider.
56
     *
57
     * @return array
58
     */
59 3
    public function provides()
60
    {
61
        return [
62
            //
63 3
        ];
64
    }
65
66
    /* -----------------------------------------------------------------
67
     |  Other Methods
68
     | -----------------------------------------------------------------
69
     */
70
    /**
71
     * Binding the models with the contracts.
72
     */
73 234
    private function bindModels()
74
    {
75
        $bindings = [
76 234
            'users'              => AuthContracts\User::class,
77 78
            'roles'              => AuthContracts\Role::class,
78 78
            'permissions'        => AuthContracts\Permission::class,
79 78
            'permissions-groups' => AuthContracts\PermissionsGroup::class,
80 78
        ];
81
82 234
        foreach ($bindings as $key => $contract) {
83 234
            $this->bind($contract, $this->config()->get("laravel-auth.$key.model"));
84 78
        }
85 234
    }
86
}
87