1
|
|
|
<?php |
2
|
|
|
namespace Caffeinated\Modules\Providers; |
3
|
|
|
|
4
|
|
|
use Illuminate\Support\ServiceProvider; |
5
|
|
|
|
6
|
|
|
class ConsoleServiceProvider extends ServiceProvider |
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* Bootstrap the application services. |
10
|
|
|
* |
11
|
|
|
* @return void |
12
|
|
|
*/ |
13
|
|
|
public function boot() |
14
|
|
|
{ |
15
|
|
|
// |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Register the application services. |
20
|
|
|
* |
21
|
|
|
* @return void |
22
|
|
|
*/ |
23
|
|
|
public function register() |
24
|
|
|
{ |
25
|
|
|
$this->registerDisableCommand(); |
26
|
|
|
$this->registerEnableCommand(); |
27
|
|
|
$this->registerListCommand(); |
28
|
|
|
$this->registerMigrateCommand(); |
29
|
|
|
$this->registerMigrateRefreshCommand(); |
30
|
|
|
$this->registerMigrateResetCommand(); |
31
|
|
|
$this->registerMigrateRollbackCommand(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Register the module:disable command. |
36
|
|
|
* |
37
|
|
|
* @return void |
38
|
|
|
*/ |
39
|
|
|
protected function registerDisableCommand() |
40
|
|
|
{ |
41
|
|
|
$this->app->singleton('command.module.disable', function() { |
42
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleDisableCommand; |
43
|
|
|
}); |
44
|
|
|
|
45
|
|
|
$this->commands('command.module.disable'); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Register the module:enable command. |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
protected function registerEnableCommand() |
54
|
|
|
{ |
55
|
|
|
$this->app->singleton('command.module.enable', function() { |
56
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleEnableCommand; |
57
|
|
|
}); |
58
|
|
|
|
59
|
|
|
$this->commands('command.module.enable'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Register the module:list command. |
64
|
|
|
* |
65
|
|
|
* @return void |
66
|
|
|
*/ |
67
|
|
|
protected function registerListCommand() |
68
|
|
|
{ |
69
|
|
|
$this->app->singleton('command.module.list', function($app) { |
70
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleListCommand($app['modules']); |
71
|
|
|
}); |
72
|
|
|
|
73
|
|
|
$this->commands('command.module.list'); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Register the module:migrate command. |
78
|
|
|
* |
79
|
|
|
* @return void |
80
|
|
|
*/ |
81
|
|
|
protected function registerMigrateCommand() |
82
|
|
|
{ |
83
|
|
|
$this->app->singleton('command.module.migrate', function($app) { |
84
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateCommand($app['migrator'], $app['modules']); |
85
|
|
|
}); |
86
|
|
|
|
87
|
|
|
$this->commands('command.module.migrate'); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Register the module:migrate:refresh command. |
92
|
|
|
* |
93
|
|
|
* @return void |
94
|
|
|
*/ |
95
|
|
|
protected function registerMigrateRefreshCommand() |
96
|
|
|
{ |
97
|
|
|
$this->app->singleton('command.module.migrate.refresh', function() { |
98
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateRefreshCommand; |
99
|
|
|
}); |
100
|
|
|
|
101
|
|
|
$this->commands('command.module.migrate.refresh'); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Register the module:migrate:reset command. |
106
|
|
|
* |
107
|
|
|
* @return void |
108
|
|
|
*/ |
109
|
|
|
protected function registerMigrateResetCommand() |
110
|
|
|
{ |
111
|
|
|
$this->app->singleton('command.module.migrate.reset', function($app) { |
112
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateResetCommand($app['modules'], $app['files'], $app['migrator']); |
113
|
|
|
}); |
114
|
|
|
|
115
|
|
|
$this->commands('command.module.migrate.reset'); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Register the module:migrate:rollback command. |
120
|
|
|
* |
121
|
|
|
* @return void |
122
|
|
|
*/ |
123
|
|
|
protected function registerMigrateRollbackCommand() |
124
|
|
|
{ |
125
|
|
|
$this->app->singleton('command.module.migrate.rollback', function($app) { |
126
|
|
|
return new \Caffeinated\Modules\Console\Commands\ModuleMigrateRollbackCommand($app['modules']); |
127
|
|
|
}); |
128
|
|
|
|
129
|
|
|
$this->commands('command.module.migrate.rollback'); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|