Completed
Push — master ( e43e24...a5d827 )
by ARCANEDEV
05:31
created

AuthServiceProvider::getConfigKey()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanesoft\Auth;
2
3
use Arcanesoft\Core\Bases\PackageServiceProvider;
4
5
/**
6
 * Class     AuthServiceProvider
7
 *
8
 * @package  Arcanesoft\Auth
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class AuthServiceProvider extends PackageServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Properties
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Package name.
19
     *
20
     * @var string
21
     */
22
    protected $package      = 'auth';
23
24
    /* ------------------------------------------------------------------------------------------------
25
     |  Getters & Setters
26
     | ------------------------------------------------------------------------------------------------
27
     */
28
    /**
29
     * Get the base path of the package.
30
     *
31
     * @return string
32
     */
33
    public function getBasePath()
34
    {
35
        return dirname(__DIR__);
36
    }
37
38
    /* ------------------------------------------------------------------------------------------------
39
     |  Main Functions
40 18
     | ------------------------------------------------------------------------------------------------
41
     */
42 18
    /**
43
     * Register the service provider.
44
     */
45
    public function register()
46
    {
47
        $this->registerConfig();
48
49
        $this->app->register(\Arcanesoft\Core\CoreServiceProvider::class);
50 18
        $this->app->register(Providers\PackagesServiceProvider::class);
51
        $this->app->register(Providers\AuthorizationServiceProvider::class);
52 18
        $this->app->register(Providers\ComposerServiceProvider::class);
53
54
        if ($this->app->runningInConsole()) {
55
            $this->app->register(Providers\CommandServiceProvider::class);
56
        }
57
    }
58
59
    /**
60
     * Boot the service provider.
61
     */
62 18
    public function boot()
63
    {
64 18
        $this->registerPublishes();
65
66 18
        $this->app->register(Providers\RouteServiceProvider::class);
67 18
    }
68 18
69 18
    /**
70
     * Get the services provided by the provider.
71 18
     *
72 18
     * @return array
73 18
     */
74 18
    public function provides()
75
    {
76
        return [
77
            //
78
        ];
79 18
    }
80
81 18
    /* ------------------------------------------------------------------------------------------------
82
     |  Other Functions
83 18
     | ------------------------------------------------------------------------------------------------
84 18
     */
85
    /**
86
     * Register publishes.
87
     */
88
    private function registerPublishes()
89
    {
90
        // Config
91 3
        $this->publishes([
92
            $this->getConfigFile() => config_path("{$this->vendor}/{$this->package}.php"),
93
        ], 'config');
94
95 3
        // Views
96
        $viewsPath = $this->getBasePath() . '/resources/views';
97
        $this->loadViewsFrom($viewsPath, 'auth');
98
        $this->publishes([
99
            $viewsPath => base_path('resources/views/vendor/auth'),
100
        ], 'views');
101
102
        // Translations
103
        $translationsPath = $this->getBasePath() . '/resources/lang';
104
        $this->loadTranslationsFrom($translationsPath, 'auth');
105 18
        $this->publishes([
106
            $translationsPath => base_path('resources/lang/vendor/auth'),
107
        ], 'lang');
108 18
    }
109
}
110