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