UsersServiceProvider::loadViews()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
1
<?php namespace NukaCode\Users\Providers;
2
3
use Config;
4
use Illuminate\Support\ServiceProvider;
5
6
class UsersServiceProvider extends ServiceProvider
7
{
8
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = false;
15
16
    /**
17
     * Register bindings in the container.
18
     *
19
     * @return void
20
     */
21
    public function register()
22
    {
23
        $this->mergeConfigFrom(__DIR__ . '/../../../config/config.php', 'users');
24
    }
25
26
    /**
27
     * Register the service provider.
28
     *
29
     * @return void
30
     */
31
    public function boot()
32
    {
33
        $this->loadConfigs();
34
        $this->loadMigrations();
35
        $this->loadViews();
36
    }
37
38
    /**
39
     * Load the configs.
40
     *
41
     * @return void
42
     */
43
    protected function loadConfigs()
44
    {
45
        $this->publishes([
46
            __DIR__ . '/../../../config/config.php' => config_path('users.php'),
47
        ]);
48
    }
49
50
    /**
51
     * Load the migrations.
52
     *
53
     * @return void
54
     */
55
    protected function loadMigrations()
56
    {
57
        $this->loadMigrationsFrom(__DIR__ . '/../../../database/migrations');
58
59
        if ($this->app['config']->get('users.enable_social')) {
60
            $this->loadMigrationsFrom(__DIR__ . '/../../../database/social_migrations');
61
        }
62
    }
63
64
    /**
65
     * Register views
66
     *
67
     * @return void
68
     */
69
    protected function loadViews()
70
    {
71
        if ($this->app['config']->get('users.load_views')) {
72
            $this->app['view']->addLocation(__DIR__ . '/../../../views');
73
        }
74
    }
75
}
76