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
|
|
|
| Main Methods |
26
|
|
|
| ----------------------------------------------------------------- |
27
|
|
|
*/ |
28
|
|
|
/** |
29
|
|
|
* Register the service provider. |
30
|
|
|
*/ |
31
|
|
|
public function register() |
32
|
|
|
{ |
33
|
21 |
|
parent::register(); |
34
|
|
|
|
35
|
21 |
|
$this->registerConfig(); |
36
|
|
|
$this->registerSidebarItems(); |
37
|
|
|
$this->registerProviders([ |
38
|
|
|
Providers\PackagesServiceProvider::class, |
39
|
|
|
Providers\AuthorizationServiceProvider::class, |
40
|
|
|
]); |
41
|
|
|
$this->registerModuleProviders(); |
42
|
|
|
$this->registerConsoleServiceProvider(Providers\CommandServiceProvider::class); |
43
|
|
|
$this->registerFoundationService(); |
44
|
|
|
} |
45
|
21 |
|
|
46
|
|
|
/** |
47
|
21 |
|
* Boot the service provider. |
48
|
|
|
*/ |
49
|
21 |
|
public function boot() |
50
|
21 |
|
{ |
51
|
21 |
|
$this->registerProviders([ |
52
|
21 |
|
Providers\RouteServiceProvider::class, |
53
|
|
|
Providers\ViewComposerServiceProvider::class, |
54
|
|
|
]); |
55
|
21 |
|
|
56
|
21 |
|
// Publishes |
57
|
21 |
|
$this->publishConfig(); |
58
|
21 |
|
$this->publishViews(); |
59
|
|
|
$this->publishTranslations(); |
60
|
|
|
$this->publishSidebarItems(); |
61
|
|
|
} |
62
|
|
|
|
63
|
21 |
|
/** |
64
|
|
|
* Get the services provided by the provider. |
65
|
21 |
|
* |
66
|
21 |
|
* @return array |
67
|
|
|
*/ |
68
|
|
|
public function provides() |
69
|
|
|
{ |
70
|
|
|
return [ |
71
|
21 |
|
Contracts\Foundation::class, |
72
|
21 |
|
]; |
73
|
21 |
|
} |
74
|
21 |
|
|
75
|
21 |
|
/* ----------------------------------------------------------------- |
76
|
|
|
| Services Functions |
77
|
|
|
| ----------------------------------------------------------------- |
78
|
|
|
*/ |
79
|
|
|
/** |
80
|
|
|
* Register Foundation service. |
81
|
|
|
*/ |
82
|
3 |
|
private function registerFoundationService() |
83
|
|
|
{ |
84
|
|
|
$this->singleton(Contracts\Foundation::class, Foundation::class); |
85
|
3 |
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Register ARCANESOFT's modules (providers). |
89
|
|
|
*/ |
90
|
|
|
private function registerModuleProviders() |
91
|
|
|
{ |
92
|
|
|
$this->registerProviders( |
93
|
|
|
$this->config()->get('arcanesoft.foundation.modules.providers', []) |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|