Completed
Push — master ( 74da27...ac625a )
by wen
12:26
created

PublishServiceProvider   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 58
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getBasePath() 0 4 1
A boot() 0 10 2
A register() 0 4 1
A publishAssets() 0 6 1
A publishConfig() 0 6 1
A publishViews() 0 6 1
A publishTranslations() 0 6 1
A publishRoutes() 0 6 1
1
<?php
2
3
4
namespace Sco\Admin\Providers;
5
6
7
use Illuminate\Support\ServiceProvider;
8
9
class PublishServiceProvider extends ServiceProvider
10
{
11
    public function getBasePath()
12
    {
13
        return dirname(dirname(__DIR__));
14
    }
15
16
    public function boot()
17
    {
18
        if ($this->app->runningInConsole()) {
19
            $this->publishAssets();
20
            $this->publishConfig();
21
            $this->publishViews();
22
            $this->publishTranslations();
23
            $this->publishRoutes();
24
        }
25
    }
26
27
    public function register()
28
    {
29
30
    }
31
32
    protected function publishAssets()
33
    {
34
        $this->publishes([
35
            $this->getBasePath() . '/resources/assets' => base_path('resources/assets/vendor/admin'),
36
        ], 'assets');
37
    }
38
39
    protected function publishConfig()
40
    {
41
        $this->publishes([
42
            $this->getBasePath() . '/config/' => config_path(),
43
        ], 'config');
44
    }
45
46
    protected function publishViews()
47
    {
48
        $this->publishes([
49
            $this->getBasePath() . '/resources/views' => base_path('resources/views/vendor/admin'),
50
        ], 'views');
51
    }
52
53
    protected function publishTranslations()
54
    {
55
        $this->publishes([
56
            $this->getBasePath() . '/resources/lang' => base_path('resources/lang/vendor/admin'),
57
        ], 'lang');
58
    }
59
60
    protected function publishRoutes()
61
    {
62
        $this->publishes([
63
            $this->getBasePath() . '/routes/admin.php' => base_path('routes/admin.php'),
64
        ], 'routes');
65
    }
66
}
67