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