1 | <?php namespace Arcanedev\Support; |
||
14 | abstract class PackageServiceProvider extends ServiceProvider |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Properties |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | /** |
||
21 | * Vendor name. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $vendor = 'arcanedev'; |
||
26 | |||
27 | /** |
||
28 | * Package name. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $package = ''; |
||
33 | |||
34 | /** |
||
35 | * Package base path. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $basePath; |
||
40 | |||
41 | /** |
||
42 | * Merge multiple config files into one instance (package name as root key) |
||
43 | * |
||
44 | * @var bool |
||
45 | */ |
||
46 | protected $multiConfigs = false; |
||
47 | |||
48 | /* ----------------------------------------------------------------- |
||
49 | | Constructor |
||
50 | | ----------------------------------------------------------------- |
||
51 | */ |
||
52 | /** |
||
53 | * Create a new service provider instance. |
||
54 | * |
||
55 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
56 | */ |
||
57 | 9 | public function __construct(Application $app) |
|
63 | |||
64 | /** |
||
65 | * Resolve the base path of the package. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | 9 | protected function resolveBasePath() |
|
76 | |||
77 | /* ----------------------------------------------------------------- |
||
78 | | Getters & Setters |
||
79 | | ----------------------------------------------------------------- |
||
80 | */ |
||
81 | /** |
||
82 | * Get the base path of the package. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getBasePath() |
||
90 | |||
91 | /** |
||
92 | * Get config folder. |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | 9 | protected function getConfigFolder() |
|
100 | |||
101 | /** |
||
102 | * Get config key. |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | 9 | protected function getConfigKey() |
|
110 | |||
111 | /** |
||
112 | * Get config file path. |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | 9 | protected function getConfigFile() |
|
120 | |||
121 | /** |
||
122 | * Get config file destination path. |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | protected function getConfigFileDestination() |
||
130 | |||
131 | /** |
||
132 | * Get the base database path. |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | protected function getDatabasePath() |
||
140 | |||
141 | /** |
||
142 | * Get the migrations path. |
||
143 | * |
||
144 | * @return string |
||
145 | */ |
||
146 | protected function getMigrationsPath() |
||
150 | |||
151 | /** |
||
152 | * Get the base resources path. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | protected function getResourcesPath() |
||
160 | |||
161 | /** |
||
162 | * Get the base views path. |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | protected function getViewsPath() |
||
170 | |||
171 | /** |
||
172 | * Get the destination views path. |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | protected function getViewsDestinationPath() |
||
180 | |||
181 | /** |
||
182 | * Get the translations path. |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | protected function getTranslationsPath() |
||
190 | |||
191 | /** |
||
192 | * Get the destination views path. |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | protected function getTranslationsDestinationPath() |
||
200 | |||
201 | /* ----------------------------------------------------------------- |
||
202 | | Main Methods |
||
203 | | ----------------------------------------------------------------- |
||
204 | */ |
||
205 | /** |
||
206 | * Register the service provider. |
||
207 | */ |
||
208 | public function register() |
||
214 | |||
215 | /* ----------------------------------------------------------------- |
||
216 | | Package Methods |
||
217 | | ----------------------------------------------------------------- |
||
218 | */ |
||
219 | /** |
||
220 | * Register configs. |
||
221 | * |
||
222 | * @param string $separator |
||
223 | */ |
||
224 | 9 | protected function registerConfig($separator = '.') |
|
230 | |||
231 | /** |
||
232 | * Register all package configs. |
||
233 | * |
||
234 | * @param string $separator |
||
235 | */ |
||
236 | private function registerMultipleConfigs($separator = '.') |
||
244 | |||
245 | /** |
||
246 | * Register commands service provider. |
||
247 | * |
||
248 | * @param \Illuminate\Support\ServiceProvider|string $provider |
||
249 | */ |
||
250 | protected function registerCommands($provider) |
||
254 | |||
255 | /** |
||
256 | * Publish the config file. |
||
257 | */ |
||
258 | protected function publishConfig() |
||
264 | |||
265 | /** |
||
266 | * Publish the migration files. |
||
267 | */ |
||
268 | protected function publishMigrations() |
||
274 | |||
275 | /** |
||
276 | * Publish and load the views if $load argument is true. |
||
277 | * |
||
278 | * @param bool $load |
||
279 | */ |
||
280 | protected function publishViews($load = true) |
||
288 | |||
289 | /** |
||
290 | * Publish and load the translations if $load argument is true. |
||
291 | * |
||
292 | * @param bool $load |
||
293 | */ |
||
294 | protected function publishTranslations($load = true) |
||
302 | |||
303 | /** |
||
304 | * Publish the factories. |
||
305 | */ |
||
306 | protected function publishFactories() |
||
312 | |||
313 | /** |
||
314 | * Publish all the package files. |
||
315 | * |
||
316 | * @param bool $load |
||
317 | */ |
||
318 | protected function publishAll($load = true) |
||
326 | |||
327 | /** |
||
328 | * Load the views files. |
||
329 | */ |
||
330 | protected function loadViews() |
||
334 | |||
335 | /** |
||
336 | * Load the translations files. |
||
337 | */ |
||
338 | protected function loadTranslations() |
||
342 | |||
343 | /** |
||
344 | * Load the migrations files. |
||
345 | */ |
||
346 | protected function loadMigrations() |
||
350 | |||
351 | /* ------------------------------------------------------------------------------------------------ |
||
352 | | Check Functions |
||
353 | | ------------------------------------------------------------------------------------------------ |
||
354 | */ |
||
355 | /** |
||
356 | * Check package name. |
||
357 | * |
||
358 | * @throws \Arcanedev\Support\Exceptions\PackageException |
||
359 | */ |
||
360 | 9 | private function checkPackageName() |
|
365 | |||
366 | /* ----------------------------------------------------------------- |
||
367 | | Deprecated Methods |
||
368 | | ----------------------------------------------------------------- |
||
369 | */ |
||
370 | /** |
||
371 | * Setup package path and stuff. |
||
372 | * |
||
373 | * @deprecated: Stop using this method starting arcanedev/support >= v4.2 |
||
374 | */ |
||
375 | 9 | protected function setup() |
|
380 | } |
||
381 |