|
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
|
24 |
|
public function getBasePath() |
|
34
|
|
|
{ |
|
35
|
24 |
|
return dirname(__DIR__); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
39
|
|
|
| Main Functions |
|
40
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
41
|
|
|
*/ |
|
42
|
|
|
/** |
|
43
|
|
|
* Register the service provider. |
|
44
|
|
|
*/ |
|
45
|
24 |
|
public function register() |
|
46
|
|
|
{ |
|
47
|
24 |
|
$this->registerConfig(); |
|
48
|
24 |
|
$this->registerSidebarItems(); |
|
49
|
24 |
|
$this->registerServiceProviders(); |
|
50
|
24 |
|
$this->registerFoundationService(); |
|
51
|
|
|
|
|
52
|
24 |
|
if ($this->app->runningInConsole()) { |
|
53
|
24 |
|
$this->app->register(Providers\CommandServiceProvider::class); |
|
54
|
18 |
|
} |
|
55
|
24 |
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Boot the service provider. |
|
59
|
|
|
*/ |
|
60
|
24 |
|
public function boot() |
|
61
|
|
|
{ |
|
62
|
24 |
|
$this->app->register(Providers\RouteServiceProvider::class); |
|
63
|
24 |
|
$this->app->register(Providers\ComposerServiceProvider::class); |
|
64
|
|
|
|
|
65
|
|
|
// Publishes |
|
66
|
24 |
|
$this->publishConfig(); |
|
|
|
|
|
|
67
|
24 |
|
$this->publishViews(); |
|
|
|
|
|
|
68
|
24 |
|
$this->publishTranslations(); |
|
|
|
|
|
|
69
|
24 |
|
$this->publishSidebarItems(); |
|
70
|
24 |
|
$this->publishAssets(); |
|
71
|
24 |
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Get the services provided by the provider. |
|
75
|
|
|
* |
|
76
|
|
|
* @return array |
|
77
|
|
|
*/ |
|
78
|
4 |
|
public function provides() |
|
79
|
|
|
{ |
|
80
|
4 |
|
return ['arcanesoft.foundation']; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
84
|
|
|
| Services Functions |
|
85
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
86
|
|
|
*/ |
|
87
|
|
|
/** |
|
88
|
|
|
* Register all the required service providers. |
|
89
|
|
|
*/ |
|
90
|
24 |
|
private function registerServiceProviders() |
|
91
|
|
|
{ |
|
92
|
24 |
|
$this->app->register(\Arcanesoft\Core\CoreServiceProvider::class); |
|
93
|
24 |
|
$this->app->register(Providers\PackagesServiceProvider::class); |
|
94
|
24 |
|
$this->app->register(Providers\ModuleServiceProvider::class); |
|
95
|
24 |
|
$this->app->register(Providers\AuthorizationServiceProvider::class); |
|
96
|
24 |
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Register Foundation service. |
|
100
|
|
|
*/ |
|
101
|
24 |
|
private function registerFoundationService() |
|
102
|
|
|
{ |
|
103
|
24 |
|
$this->singleton('arcanesoft.foundation', Foundation::class); |
|
104
|
24 |
|
} |
|
105
|
|
|
|
|
106
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
107
|
|
|
| Other Functions |
|
108
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
109
|
|
|
*/ |
|
110
|
|
|
/** |
|
111
|
|
|
* Publish assets. |
|
112
|
|
|
*/ |
|
113
|
24 |
|
private function publishAssets() |
|
114
|
|
|
{ |
|
115
|
24 |
|
$this->publishes([ |
|
116
|
24 |
|
$this->getBasePath() . '/resources/assets/dist' => public_path("vendor/{$this->package}"), |
|
117
|
24 |
|
], 'assets'); |
|
118
|
24 |
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.