1
|
|
|
<?php namespace Arcanesoft\Foundation; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Core\Bases\PackageServiceProvider; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class FoundationServiceProvider |
7
|
|
|
* |
8
|
|
|
* @package Arcanesoft\Foundation |
9
|
|
|
* @author ARCANEDEV <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class FoundationServiceProvider extends PackageServiceProvider |
12
|
|
|
{ |
13
|
|
|
/* ------------------------------------------------------------------------------------------------ |
14
|
|
|
| Properties |
15
|
|
|
| ------------------------------------------------------------------------------------------------ |
16
|
|
|
*/ |
17
|
|
|
/** |
18
|
|
|
* Package name. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $package = 'foundation'; |
23
|
|
|
|
24
|
|
|
/* ------------------------------------------------------------------------------------------------ |
25
|
|
|
| Getters & Setters |
26
|
|
|
| ------------------------------------------------------------------------------------------------ |
27
|
|
|
*/ |
28
|
|
|
/** |
29
|
|
|
* Get the base path of the package. |
30
|
|
|
* |
31
|
|
|
* @return string |
32
|
|
|
*/ |
33
|
21 |
|
public function getBasePath() |
34
|
|
|
{ |
35
|
21 |
|
return dirname(__DIR__); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/* ------------------------------------------------------------------------------------------------ |
39
|
|
|
| Main Functions |
40
|
|
|
| ------------------------------------------------------------------------------------------------ |
41
|
|
|
*/ |
42
|
|
|
/** |
43
|
|
|
* Register the service provider. |
44
|
|
|
*/ |
45
|
21 |
|
public function register() |
46
|
|
|
{ |
47
|
21 |
|
parent::register(); |
48
|
|
|
|
49
|
21 |
|
$this->registerConfig(); |
50
|
21 |
|
$this->registerSidebarItems(); |
51
|
21 |
|
$this->registerProviders([ |
52
|
21 |
|
Providers\PackagesServiceProvider::class, |
53
|
|
|
Providers\AuthorizationServiceProvider::class, |
54
|
|
|
]); |
55
|
21 |
|
$this->registerModuleProviders(); |
56
|
21 |
|
$this->registerConsoleServiceProvider(Providers\CommandServiceProvider::class); |
57
|
21 |
|
$this->registerFoundationService(); |
58
|
21 |
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Boot the service provider. |
62
|
|
|
*/ |
63
|
|
|
public function boot() |
64
|
|
|
{ |
65
|
|
|
$this->registerProviders([ |
66
|
|
|
Providers\RouteServiceProvider::class, |
67
|
|
|
Providers\ViewComposerServiceProvider::class, |
68
|
|
|
]); |
69
|
|
|
|
70
|
|
|
// Publishes |
71
|
|
|
$this->publishConfig(); |
72
|
|
|
$this->publishViews(); |
73
|
|
|
$this->publishTranslations(); |
74
|
|
|
$this->publishSidebarItems(); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Get the services provided by the provider. |
79
|
|
|
* |
80
|
|
|
* @return array |
81
|
|
|
*/ |
82
|
|
|
public function provides() |
83
|
|
|
{ |
84
|
|
|
return [ |
85
|
|
|
Contracts\Foundation::class, |
86
|
|
|
]; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/* ------------------------------------------------------------------------------------------------ |
90
|
|
|
| Services Functions |
91
|
|
|
| ------------------------------------------------------------------------------------------------ |
92
|
|
|
*/ |
93
|
|
|
/** |
94
|
|
|
* Register Foundation service. |
95
|
|
|
*/ |
96
|
21 |
|
private function registerFoundationService() |
97
|
|
|
{ |
98
|
21 |
|
$this->singleton(Contracts\Foundation::class, Foundation::class); |
99
|
21 |
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Register ARCANESOFT's modules (providers). |
103
|
|
|
*/ |
104
|
21 |
|
private function registerModuleProviders() |
105
|
|
|
{ |
106
|
21 |
|
$this->registerProviders( |
107
|
21 |
|
$this->config()->get('arcanesoft.foundation.modules.providers', []) |
108
|
|
|
); |
109
|
21 |
|
} |
110
|
|
|
} |
111
|
|
|
|