Completed
Push — master ( b05f68...7c0ee5 )
by wen
10:39
created

ResourcesServiceProvider::publishTranslations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
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
        $this->loadViewsFrom(
17
            $this->getBasePath() . '/resources/views',
18 48
            'admin'
19 48
        );
20 48
21
        if ($this->app->runningInConsole()) {
22
            $this->publishAssets();
23 48
            $this->publishConfig();
24 48
            $this->publishViews();
25 48
        }
26
    }
27
28 48
    public function register()
29 48
    {
30 48
    }
31 48
32 48
    protected function publishAssets()
33
    {
34
        $this->publishes([
35 48
            $this->getBasePath() . '/resources/assets' => base_path('resources/assets/vendor/admin'),
36
        ], 'assets');
37 48
    }
38
39 48
    protected function publishConfig()
40
    {
41 48
        $this->publishes([
42
            $this->getBasePath() . '/config/' => config_path(),
43 48
        ], 'config');
44 48
    }
45 48
46 48
    protected function publishViews()
47
    {
48 48
        $this->publishes([
49
            $this->getBasePath() . '/resources/views' => base_path('resources/views/vendor/admin'),
50 48
        ], 'views');
51 48
    }
52
}
53