1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bantenprov\DashboardApel; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Bantenprov\DashboardApel\Console\Commands\DashboardApelCommand; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* The DashboardApelServiceProvider class |
10
|
|
|
* |
11
|
|
|
* @package Bantenprov\DashboardApel |
12
|
|
|
* @author bantenprov <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class DashboardApelServiceProvider extends ServiceProvider |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Indicates if loading of the provider is deferred. |
19
|
|
|
* |
20
|
|
|
* @var bool |
21
|
|
|
*/ |
22
|
|
|
protected $defer = false; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Bootstrap the application events. |
26
|
|
|
* |
27
|
|
|
* @return void |
28
|
|
|
*/ |
29
|
|
|
public function boot() |
30
|
|
|
{ |
31
|
|
|
// Bootstrap handles |
32
|
|
|
$this->routeHandle(); |
33
|
|
|
$this->configHandle(); |
34
|
|
|
$this->langHandle(); |
35
|
|
|
$this->viewHandle(); |
36
|
|
|
$this->assetHandle(); |
37
|
|
|
$this->migrationHandle(); |
38
|
|
|
$this->publicHandle(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Register the service provider. |
43
|
|
|
* |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
public function register() |
47
|
|
|
{ |
48
|
|
|
$this->app->singleton('dashboard-apel', function ($app) { |
|
|
|
|
49
|
|
|
return new DashboardApel; |
50
|
|
|
}); |
51
|
|
|
|
52
|
|
|
$this->app->singleton('command.dashboard-apel', function ($app) { |
|
|
|
|
53
|
|
|
return new DashboardApelCommand; |
54
|
|
|
}); |
55
|
|
|
|
56
|
|
|
$this->commands('command.dashboard-apel'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Get the services provided by the provider. |
61
|
|
|
* |
62
|
|
|
* @return array |
63
|
|
|
*/ |
64
|
|
|
public function provides() |
65
|
|
|
{ |
66
|
|
|
return [ |
67
|
|
|
'dashboard-apel', |
68
|
|
|
'command.dashboard-apel', |
69
|
|
|
]; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Loading package routes |
74
|
|
|
* |
75
|
|
|
* @return void |
76
|
|
|
*/ |
77
|
|
|
protected function routeHandle() |
78
|
|
|
{ |
79
|
|
|
$this->loadRoutesFrom(__DIR__.'/routes/routes.php'); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Loading and publishing package's config |
84
|
|
|
* |
85
|
|
|
* @return void |
86
|
|
|
*/ |
87
|
|
|
protected function configHandle() |
88
|
|
|
{ |
89
|
|
|
$packageConfigPath = __DIR__.'/config/config.php'; |
90
|
|
|
$appConfigPath = config_path('dashboard-apel.php'); |
91
|
|
|
|
92
|
|
|
$this->mergeConfigFrom($packageConfigPath, 'dashboard-apel'); |
93
|
|
|
|
94
|
|
|
$this->publishes([ |
95
|
|
|
$packageConfigPath => $appConfigPath, |
96
|
|
|
], 'config'); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Loading and publishing package's translations |
101
|
|
|
* |
102
|
|
|
* @return void |
103
|
|
|
*/ |
104
|
|
|
protected function langHandle() |
105
|
|
|
{ |
106
|
|
|
$packageTranslationsPath = __DIR__.'/resources/lang'; |
107
|
|
|
|
108
|
|
|
$this->loadTranslationsFrom($packageTranslationsPath, 'dashboard-apel'); |
109
|
|
|
|
110
|
|
|
$this->publishes([ |
111
|
|
|
$packageTranslationsPath => resource_path('lang/vendor/dashboard-apel'), |
112
|
|
|
], 'lang'); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Loading and publishing package's views |
117
|
|
|
* |
118
|
|
|
* @return void |
119
|
|
|
*/ |
120
|
|
|
protected function viewHandle() |
121
|
|
|
{ |
122
|
|
|
$packageViewsPath = __DIR__.'/resources/views'; |
123
|
|
|
|
124
|
|
|
$this->loadViewsFrom($packageViewsPath, 'dashboard-apel'); |
125
|
|
|
|
126
|
|
|
$this->publishes([ |
127
|
|
|
$packageViewsPath => resource_path('views/vendor/dashboard-apel'), |
128
|
|
|
], 'views'); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Publishing package's assets (JavaScript, CSS, images...) |
133
|
|
|
* |
134
|
|
|
* @return void |
135
|
|
|
*/ |
136
|
|
|
protected function assetHandle() |
137
|
|
|
{ |
138
|
|
|
$packageAssetsPath = __DIR__.'/resources/assets'; |
139
|
|
|
|
140
|
|
|
$this->publishes([ |
141
|
|
|
$packageAssetsPath => resource_path('assets'), |
142
|
|
|
], 'dashboard-apel-assets'); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Publishing package's migrations |
147
|
|
|
* |
148
|
|
|
* @return void |
149
|
|
|
*/ |
150
|
|
|
protected function migrationHandle() |
151
|
|
|
{ |
152
|
|
|
$packageMigrationsPath = __DIR__.'/database/migrations'; |
153
|
|
|
|
154
|
|
|
$this->loadMigrationsFrom($packageMigrationsPath); |
155
|
|
|
|
156
|
|
|
$this->publishes([ |
157
|
|
|
$packageMigrationsPath => database_path('migrations') |
158
|
|
|
], 'migrations'); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
public function publicHandle() |
162
|
|
|
{ |
163
|
|
|
$packagePublicPath = __DIR__.'/public'; |
164
|
|
|
|
165
|
|
|
$this->publishes([ |
166
|
|
|
$packagePublicPath => base_path('public') |
167
|
|
|
], 'dashboard-apel-public'); |
168
|
|
|
} |
169
|
|
|
} |
170
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.