1 | <?php |
||
8 | class ServiceProvider extends BaseServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Addon environment. |
||
12 | * |
||
13 | * @var \Jumilla\Addomnipot\Laravel\Environment |
||
14 | */ |
||
15 | protected $addonEnvironment; |
||
16 | |||
17 | /** |
||
18 | * Register the service provider. |
||
19 | */ |
||
20 | 1 | public function register() |
|
21 | { |
||
22 | 1 | $app = $this->app; |
|
23 | |||
24 | 1 | $app->instance('addon', $this->addonEnvironment = new Environment($app)); |
|
25 | 1 | $app->alias('addon', Environment::class); |
|
26 | |||
27 | $app->singleton(Generator::class, function ($app) { |
||
|
|||
28 | return new Generator(); |
||
29 | 1 | }); |
|
30 | |||
31 | 1 | $this->registerCommands(); |
|
32 | |||
33 | 1 | $this->registerClassResolvers(); |
|
34 | |||
35 | 1 | foreach ($this->addonEnvironment->addons() as $addon) { |
|
36 | $addon->register($this->app); |
||
37 | 1 | } |
|
38 | |||
39 | 1 | $this->commands($this->addonEnvironment->addonConsoleCommands()); |
|
40 | |||
41 | 1 | foreach ($this->addonEnvironment->addonHttpMiddlewares() as $middleware) { |
|
42 | $this->app[HttpKernel::class]->pushMiddleware($middleware); |
||
43 | 1 | } |
|
44 | |||
45 | 1 | foreach ($this->addonEnvironment->addonRouteMiddlewares() as $key => $middleware) { |
|
46 | $this->app['router']->middleware($key, $middleware); |
||
47 | 1 | } |
|
48 | 1 | } |
|
49 | |||
50 | /** |
||
51 | * Register the cache related console commands. |
||
52 | */ |
||
53 | 1 | public function registerCommands() |
|
54 | { |
||
55 | $this->app->singleton('command.addon.list', function ($app) { |
||
56 | return new Console\AddonListCommand(); |
||
57 | 1 | }); |
|
58 | |||
59 | $this->app->singleton('command.addon.status', function ($app) { |
||
60 | return new Console\AddonStatusCommand(); |
||
61 | 1 | }); |
|
62 | |||
63 | $this->app->singleton('command.addon.make', function ($app) { |
||
64 | return new Console\AddonMakeCommand(); |
||
65 | 1 | }); |
|
66 | |||
67 | $this->app->singleton('command.addon.name', function ($app) { |
||
68 | return new Console\AddonNameCommand(); |
||
69 | 1 | }); |
|
70 | |||
71 | 1 | $this->app->singleton('command.addon.remove', function ($app) { |
|
72 | return new Console\AddonRemoveCommand(); |
||
73 | 1 | }); |
|
74 | |||
75 | 1 | $this->commands([ |
|
76 | 1 | 'command.addon.list', |
|
77 | 1 | 'command.addon.status', |
|
78 | 1 | 'command.addon.make', |
|
79 | 1 | 'command.addon.name', |
|
80 | 1 | 'command.addon.remove', |
|
81 | 1 | ]); |
|
82 | 1 | } |
|
83 | |||
84 | /** |
||
85 | */ |
||
86 | 1 | protected function registerClassResolvers() |
|
94 | |||
95 | 1 | public function boot() |
|
96 | { |
||
101 | } |
||
102 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.