|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jumilla\Addomnipot\Laravel; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider as BaseServiceProvider; |
|
6
|
|
|
use Illuminate\Contracts\Http\Kernel as HttpKernel; |
|
7
|
|
|
|
|
8
|
|
|
class ServiceProvider extends BaseServiceProvider |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Addon environment. |
|
12
|
|
|
* |
|
13
|
|
|
* @var \Jumilla\Addomnipot\Laravel\Environment |
|
14
|
|
|
*/ |
|
15
|
|
|
protected $environment; |
|
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->environment = 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 |
|
$app['events']->fire(new Events\AddonWorldCreated($this->environment)); |
|
34
|
|
|
|
|
35
|
1 |
|
$this->registerClassResolvers(); |
|
36
|
|
|
|
|
37
|
1 |
|
(new Registrar)->register($app, $this->environment->addons()); |
|
38
|
|
|
|
|
39
|
1 |
|
$app['events']->fire(new Events\AddonRegistered($this->environment)); |
|
40
|
1 |
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Register the cache related console commands. |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public function registerCommands() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->app->singleton('command.addon.list', function ($app) { |
|
|
|
|
|
|
48
|
|
|
return new Console\AddonListCommand(); |
|
49
|
1 |
|
}); |
|
50
|
|
|
|
|
51
|
|
|
$this->app->singleton('command.addon.status', function ($app) { |
|
|
|
|
|
|
52
|
|
|
return new Console\AddonStatusCommand(); |
|
53
|
1 |
|
}); |
|
54
|
|
|
|
|
55
|
|
|
$this->app->singleton('command.addon.make', function ($app) { |
|
|
|
|
|
|
56
|
|
|
return new Console\AddonMakeCommand(); |
|
57
|
1 |
|
}); |
|
58
|
|
|
|
|
59
|
|
|
$this->app->singleton('command.addon.name', function ($app) { |
|
|
|
|
|
|
60
|
|
|
return new Console\AddonNameCommand(); |
|
61
|
1 |
|
}); |
|
62
|
|
|
|
|
63
|
1 |
|
$this->app->singleton('command.addon.remove', function ($app) { |
|
|
|
|
|
|
64
|
|
|
return new Console\AddonRemoveCommand(); |
|
65
|
1 |
|
}); |
|
66
|
|
|
|
|
67
|
1 |
|
$this->commands([ |
|
68
|
1 |
|
'command.addon.list', |
|
69
|
|
|
'command.addon.status', |
|
70
|
|
|
'command.addon.make', |
|
71
|
|
|
'command.addon.name', |
|
72
|
|
|
'command.addon.remove', |
|
73
|
|
|
]); |
|
74
|
1 |
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
*/ |
|
78
|
1 |
|
protected function registerClassResolvers() |
|
79
|
|
|
{ |
|
80
|
1 |
|
$addons = $this->environment->addons(); |
|
81
|
|
|
|
|
82
|
1 |
|
ClassLoader::register($this->environment, $addons); |
|
83
|
|
|
|
|
84
|
1 |
|
AliasResolver::register($this->app['path'], $addons, $this->app['config']->get('app.aliases')); |
|
85
|
1 |
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Boot the service provider. |
|
89
|
|
|
*/ |
|
90
|
1 |
|
public function boot() |
|
91
|
|
|
{ |
|
92
|
1 |
|
$app = $this->app; |
|
93
|
|
|
|
|
94
|
1 |
|
(new Registrar)->boot($app, $this->environment->addons()); |
|
95
|
|
|
|
|
96
|
1 |
|
$app['events']->fire(new Events\AddonBooted($this->environment)); |
|
97
|
1 |
|
} |
|
98
|
|
|
} |
|
99
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.