1
|
|
|
<?php |
2
|
|
|
namespace Caffeinated\Modules\Providers; |
3
|
|
|
|
4
|
|
|
use Illuminate\Support\ServiceProvider; |
5
|
|
|
|
6
|
|
|
class ConsoleServiceProvider extends ServiceProvider |
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* @var bool $defer Indicates if loading of the provider is deferred. |
10
|
|
|
*/ |
11
|
|
|
protected $defer = false; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Boot the service provider. |
15
|
|
|
* |
16
|
|
|
* @return void |
17
|
|
|
*/ |
18
|
|
|
public function boot() |
19
|
|
|
{ |
20
|
|
|
// |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Register the service provider. |
25
|
|
|
* |
26
|
|
|
* @return void |
27
|
|
|
*/ |
28
|
|
|
public function register() |
29
|
|
|
{ |
30
|
|
|
$this->registerMakeCommand(); |
31
|
|
|
$this->registerEnableCommand(); |
32
|
|
|
$this->registerDisableCommand(); |
33
|
|
|
$this->registerMakeMigrationCommand(); |
34
|
|
|
$this->registerMakeRequestCommand(); |
35
|
|
|
$this->registerMigrateCommand(); |
36
|
|
|
$this->registerMigrateRefreshCommand(); |
37
|
|
|
$this->registerMigrateResetCommand(); |
38
|
|
|
$this->registerMigrateRollbackCommand(); |
39
|
|
|
$this->registerSeedCommand(); |
40
|
|
|
$this->registerListCommand(); |
41
|
|
|
$this->registerMakeControllerCommand(); |
42
|
|
|
|
43
|
|
|
$this->commands([ |
44
|
|
|
'modules.make', |
45
|
|
|
'modules.enable', |
46
|
|
|
'modules.disable', |
47
|
|
|
'modules.makeMigration', |
48
|
|
|
'modules.makeRequest', |
49
|
|
|
'modules.migrate', |
50
|
|
|
'modules.migrateRefresh', |
51
|
|
|
'modules.migrateReset', |
52
|
|
|
'modules.migrateRollback', |
53
|
|
|
'modules.seed', |
54
|
|
|
'modules.list', |
55
|
|
|
'modules.makeController', |
56
|
|
|
]); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Register the "module:enable" console command. |
61
|
|
|
* |
62
|
|
|
* @return Console\ModuleEnableCommand |
63
|
|
|
*/ |
64
|
|
|
protected function registerEnableCommand() |
65
|
|
|
{ |
66
|
|
|
$this->app->bindShared('modules.enable', function() { |
|
|
|
|
67
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleEnableCommand; |
68
|
|
|
}); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Register the "module:disable" console command. |
73
|
|
|
* |
74
|
|
|
* @return Console\ModuleDisableCommand |
75
|
|
|
*/ |
76
|
|
|
protected function registerDisableCommand() |
77
|
|
|
{ |
78
|
|
|
$this->app->bindShared('modules.disable', function() { |
|
|
|
|
79
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleDisableCommand; |
80
|
|
|
}); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Register the "module:make" console command. |
85
|
|
|
* |
86
|
|
|
* @return Console\ModuleMakeCommand |
87
|
|
|
*/ |
88
|
|
|
protected function registerMakeCommand() |
89
|
|
|
{ |
90
|
|
|
$this->app->bindShared('modules.make', function($app) { |
|
|
|
|
91
|
|
|
$handler = new \Caffeinated\Modules\Console\Handlers\ModuleMakeHandler($app['modules'], $app['files']); |
92
|
|
|
|
93
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMakeCommand($handler); |
94
|
|
|
}); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Register the "module:make:migration" console command. |
99
|
|
|
* |
100
|
|
|
* @return Console\ModuleMakeMigrationCommand |
101
|
|
|
*/ |
102
|
|
|
protected function registerMakeMigrationCommand() |
103
|
|
|
{ |
104
|
|
|
$this->app->bindShared('modules.makeMigration', function($app) { |
|
|
|
|
105
|
|
|
$handler = new \Caffeinated\Modules\Console\Handlers\ModuleMakeMigrationHandler($app['modules'], $app['files']); |
106
|
|
|
|
107
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMakeMigrationCommand($handler); |
108
|
|
|
}); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Register the "module:make:request" console command. |
113
|
|
|
* |
114
|
|
|
* @return Console\ModuleMakeRequestCommand |
115
|
|
|
*/ |
116
|
|
|
protected function registerMakeRequestCommand() |
117
|
|
|
{ |
118
|
|
|
$this->app->bindShared('modules.makeRequest', function($app) { |
|
|
|
|
119
|
|
|
$handler = new \Caffeinated\Modules\Console\Handlers\ModuleMakeRequestHandler($app['modules'], $app['files']); |
120
|
|
|
|
121
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMakeRequestCommand($handler); |
122
|
|
|
}); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Register the "module:migrate" console command. |
127
|
|
|
* |
128
|
|
|
* @return Console\ModuleMigrateCommand |
129
|
|
|
*/ |
130
|
|
|
protected function registerMigrateCommand() |
131
|
|
|
{ |
132
|
|
|
$this->app->bindShared('modules.migrate', function($app) { |
|
|
|
|
133
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateCommand($app['migrator'], $app['modules']); |
134
|
|
|
}); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Register the "module:migrate:refresh" console command. |
139
|
|
|
* |
140
|
|
|
* @return Console\ModuleMigrateRefreshCommand |
141
|
|
|
*/ |
142
|
|
|
protected function registerMigrateRefreshCommand() |
143
|
|
|
{ |
144
|
|
|
$this->app->bindShared('modules.migrateRefresh', function() { |
|
|
|
|
145
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateRefreshCommand; |
146
|
|
|
}); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Register the "module:migrate:reset" console command. |
151
|
|
|
* |
152
|
|
|
* @return Console\ModuleMigrateResetCommand |
153
|
|
|
*/ |
154
|
|
|
protected function registerMigrateResetCommand() |
155
|
|
|
{ |
156
|
|
|
$this->app->bindShared('modules.migrateReset', function($app) { |
|
|
|
|
157
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateResetCommand($app['modules'], $app['files'], $app['migrator']); |
158
|
|
|
}); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Register the "module:migrate:rollback" console command. |
163
|
|
|
* |
164
|
|
|
* @return Console\ModuleMigrateRollbackCommand |
165
|
|
|
*/ |
166
|
|
|
protected function registerMigrateRollbackCommand() |
167
|
|
|
{ |
168
|
|
|
$this->app->bindShared('modules.migrateRollback', function($app) { |
|
|
|
|
169
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateRollbackCommand($app['modules']); |
170
|
|
|
}); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Register the "module:seed" console command. |
175
|
|
|
* |
176
|
|
|
* @return Console\ModuleSeedCommand |
177
|
|
|
*/ |
178
|
|
|
protected function registerSeedCommand() |
179
|
|
|
{ |
180
|
|
|
$this->app->bindShared('modules.seed', function($app) { |
|
|
|
|
181
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleSeedCommand($app['modules']); |
182
|
|
|
}); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Register the "module:list" console command. |
187
|
|
|
* |
188
|
|
|
* @return Console\ModuleListCommand |
189
|
|
|
*/ |
190
|
|
|
protected function registerListCommand() |
191
|
|
|
{ |
192
|
|
|
$this->app->bindShared('modules.list', function($app) { |
|
|
|
|
193
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleListCommand($app['modules']); |
194
|
|
|
}); |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Register the "module:make:controller" console command. |
199
|
|
|
* |
200
|
|
|
* @return Console\ModuleMakeControllerCommand |
201
|
|
|
*/ |
202
|
|
|
protected function registerMakeControllerCommand() |
203
|
|
|
{ |
204
|
|
|
$this->app->bindShared('modules.makeController', function($app) { |
|
|
|
|
205
|
|
|
$handler = new \Caffeinated\Modules\Console\Handlers\ModuleMakeControllerHandler($app['modules'], $app['files']); |
206
|
|
|
|
207
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMakeControllerCommand($handler); |
208
|
|
|
}); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
} |
212
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.