1 | <?php |
||
11 | class LaravelModulesServiceProvider extends ServiceProvider |
||
12 | { |
||
13 | /** |
||
14 | * Indicates if loading of the provider is deferred. |
||
15 | * |
||
16 | * @var bool |
||
17 | */ |
||
18 | protected $defer = false; |
||
19 | |||
20 | /** |
||
21 | * Booting the package. |
||
22 | */ |
||
23 | 91 | public function boot() |
|
29 | |||
30 | /** |
||
31 | * Register all modules. |
||
32 | */ |
||
33 | 91 | protected function registerModules() |
|
37 | |||
38 | /** |
||
39 | * Register the service provider. |
||
40 | */ |
||
41 | 91 | public function register() |
|
47 | |||
48 | /** |
||
49 | * Setup stub path. |
||
50 | */ |
||
51 | 91 | public function setupStubPath() |
|
52 | { |
||
53 | $this->app->booted(function ($app) { |
||
54 | 91 | Stub::setBasePath(__DIR__ . '/Commands/stubs'); |
|
55 | |||
56 | 91 | if ($app['modules']->config('stubs.enabled') === true) { |
|
57 | 91 | Stub::setBasePath($app['modules']->config('stubs.path')); |
|
58 | } |
||
59 | 91 | }); |
|
60 | 91 | } |
|
61 | |||
62 | /** |
||
63 | * Register package's namespaces. |
||
64 | */ |
||
65 | 91 | protected function registerNamespaces() |
|
73 | |||
74 | /** |
||
75 | * Register the service provider. |
||
76 | */ |
||
77 | protected function registerServices() |
||
78 | { |
||
79 | 91 | $this->app->singleton('modules', function ($app) { |
|
80 | 91 | $path = $app['config']->get('modules.paths.modules'); |
|
81 | |||
82 | 91 | return new Repository($app, $path); |
|
83 | 91 | }); |
|
84 | 91 | } |
|
85 | |||
86 | /** |
||
87 | * Get the services provided by the provider. |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | public function provides() |
||
92 | { |
||
93 | return ['modules']; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Register providers. |
||
98 | */ |
||
99 | 91 | protected function registerProviders() |
|
104 | } |
||
105 |