ResourcesServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Sco\Admin\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class ResourcesServiceProvider extends ServiceProvider
8
{
9 48
    public function getBasePath()
10
    {
11 48
        return dirname(dirname(__DIR__));
12
    }
13
14 48
    public function boot()
15
    {
16 48
        $this->loadViewsFrom(
17 48
            $this->getBasePath() . '/resources/views',
18 48
            'admin'
19
        );
20
21 48
        if ($this->app->runningInConsole()) {
22 48
            $this->publishAssets();
23 48
            $this->publishConfig();
24 48
            $this->publishViews();
25
        }
26 48
    }
27
28 48
    public function register()
29
    {
30 48
    }
31
32 48
    protected function publishAssets()
33
    {
34 48
        $this->publishes([
35 48
            $this->getBasePath() . '/resources/assets' => base_path('resources/assets/vendor/admin'),
36 48
        ], 'assets');
37 48
    }
38
39 48
    protected function publishConfig()
40
    {
41 48
        $this->publishes([
42 48
            $this->getBasePath() . '/config/' => config_path(),
43 48
        ], 'config');
44 48
    }
45
46 48
    protected function publishViews()
47
    {
48 48
        $this->publishes([
49 48
            $this->getBasePath() . '/resources/views' => base_path('resources/views/vendor/admin'),
50 48
        ], 'views');
51 48
    }
52
}
53