1 | <?php namespace Arcanedev\Support; |
||
14 | abstract class PackageServiceProvider extends ServiceProvider |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Properties |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | * Vendor name. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $vendor = 'arcanedev'; |
||
27 | |||
28 | /** |
||
29 | * Package name. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $package = ''; |
||
34 | |||
35 | /** |
||
36 | * Package base path. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $basePath; |
||
41 | |||
42 | /** |
||
43 | * Merge multiple config files into one instance (package name as root key) |
||
44 | * |
||
45 | * @var bool |
||
46 | */ |
||
47 | protected $multiConfigs = false; |
||
48 | |||
49 | /* ----------------------------------------------------------------- |
||
50 | | Constructor |
||
51 | | ----------------------------------------------------------------- |
||
52 | */ |
||
53 | |||
54 | /** |
||
55 | * Create a new service provider instance. |
||
56 | * |
||
57 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
58 | */ |
||
59 | 6 | public function __construct(Application $app) |
|
65 | |||
66 | /** |
||
67 | * Resolve the base path of the package. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 6 | protected function resolveBasePath() |
|
77 | |||
78 | /* ----------------------------------------------------------------- |
||
79 | | Getters & Setters |
||
80 | | ----------------------------------------------------------------- |
||
81 | */ |
||
82 | |||
83 | /** |
||
84 | * Get the base path of the package. |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 6 | public function getBasePath() |
|
92 | |||
93 | /** |
||
94 | * Get config folder. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | protected function getConfigFolder() |
||
102 | |||
103 | /** |
||
104 | * Get config key. |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | 6 | protected function getConfigKey() |
|
112 | |||
113 | /** |
||
114 | * Get config file path. |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 6 | protected function getConfigFile() |
|
122 | |||
123 | /** |
||
124 | * Get config file destination path. |
||
125 | * |
||
126 | * @return string |
||
127 | */ |
||
128 | protected function getConfigFileDestination() |
||
132 | |||
133 | /** |
||
134 | * Get the base database path. |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | protected function getDatabasePath() |
||
142 | |||
143 | /** |
||
144 | * Get the migrations path. |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | protected function getMigrationsPath() |
||
152 | |||
153 | /** |
||
154 | * Get the base resources path. |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | protected function getResourcesPath() |
||
162 | |||
163 | /** |
||
164 | * Get the base views path. |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | protected function getViewsPath() |
||
172 | |||
173 | /** |
||
174 | * Get the destination views path. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | protected function getViewsDestinationPath() |
||
182 | |||
183 | /** |
||
184 | * Get the translations path. |
||
185 | * |
||
186 | * @return string |
||
187 | */ |
||
188 | protected function getTranslationsPath() |
||
192 | |||
193 | /** |
||
194 | * Get the destination views path. |
||
195 | * |
||
196 | * @return string |
||
197 | */ |
||
198 | protected function getTranslationsDestinationPath() |
||
202 | |||
203 | /* ----------------------------------------------------------------- |
||
204 | | Main Methods |
||
205 | | ----------------------------------------------------------------- |
||
206 | */ |
||
207 | |||
208 | /** |
||
209 | * Register the service provider. |
||
210 | */ |
||
211 | 6 | public function register() |
|
217 | |||
218 | /* ----------------------------------------------------------------- |
||
219 | | Package Methods |
||
220 | | ----------------------------------------------------------------- |
||
221 | */ |
||
222 | |||
223 | /** |
||
224 | * Register configs. |
||
225 | * |
||
226 | * @param string $separator |
||
227 | */ |
||
228 | 6 | protected function registerConfig($separator = '.') |
|
234 | |||
235 | /** |
||
236 | * Register all package configs. |
||
237 | * |
||
238 | * @param string $separator |
||
239 | */ |
||
240 | private function registerMultipleConfigs($separator = '.') |
||
248 | |||
249 | /** |
||
250 | * Register commands service provider. |
||
251 | * |
||
252 | * @param \Illuminate\Support\ServiceProvider|string $provider |
||
253 | */ |
||
254 | protected function registerCommands($provider) |
||
258 | |||
259 | /** |
||
260 | * Publish the config file. |
||
261 | */ |
||
262 | protected function publishConfig() |
||
268 | |||
269 | /** |
||
270 | * Publish the migration files. |
||
271 | */ |
||
272 | protected function publishMigrations() |
||
278 | |||
279 | /** |
||
280 | * Publish and load the views if $load argument is true. |
||
281 | * |
||
282 | * @param bool $load |
||
283 | */ |
||
284 | protected function publishViews($load = true) |
||
292 | |||
293 | /** |
||
294 | * Publish and load the translations if $load argument is true. |
||
295 | * |
||
296 | * @param bool $load |
||
297 | */ |
||
298 | protected function publishTranslations($load = true) |
||
306 | |||
307 | /** |
||
308 | * Publish the factories. |
||
309 | */ |
||
310 | protected function publishFactories() |
||
316 | |||
317 | /** |
||
318 | * Publish all the package files. |
||
319 | * |
||
320 | * @param bool $load |
||
321 | */ |
||
322 | protected function publishAll($load = true) |
||
330 | |||
331 | /** |
||
332 | * Load the views files. |
||
333 | */ |
||
334 | protected function loadViews() |
||
338 | |||
339 | /** |
||
340 | * Load the translations files. |
||
341 | */ |
||
342 | protected function loadTranslations() |
||
346 | |||
347 | /** |
||
348 | * Load the migrations files. |
||
349 | */ |
||
350 | protected function loadMigrations() |
||
354 | |||
355 | /* ------------------------------------------------------------------------------------------------ |
||
356 | | Check Functions |
||
357 | | ------------------------------------------------------------------------------------------------ |
||
358 | */ |
||
359 | |||
360 | /** |
||
361 | * Check package name. |
||
362 | * |
||
363 | * @throws \Arcanedev\Support\Exceptions\PackageException |
||
364 | */ |
||
365 | 6 | private function checkPackageName() |
|
370 | } |
||
371 |