Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class MigrateStatusCommand extends Command |
||
10 | { |
||
11 | /** @var string */ |
||
12 | protected $signature = 'module:migrate-status |
||
13 | {module? : Show migration status for a specific module} |
||
14 | {--d|direction=asc : The direction to order modules in} |
||
15 | {--database= : The database connection to use}'; |
||
16 | |||
17 | /** @var string */ |
||
18 | protected $description = 'See the status of module migrations.'; |
||
19 | |||
20 | /** @var \Rawilk\LaravelModules\Contracts\Repository */ |
||
21 | protected $module; |
||
22 | |||
23 | public function handle(): void |
||
24 | { |
||
25 | $this->module = $this->laravel['modules']; |
||
26 | |||
27 | if ($name = $this->option('module')) { |
||
28 | $module = $this->module->findOrFail($name); |
||
29 | |||
30 | $this->migrateStatus($module); |
||
31 | |||
32 | return; |
||
33 | } |
||
34 | |||
35 | /** @var \Rawilk\LaravelModules\Module $module */ |
||
36 | foreach ($this->module->getOrdered($this->option('direction')) as $module) { |
||
37 | $this->line("Getting migration status for module: <info>{$module->getName()}</info>"); |
||
38 | |||
39 | $this->migrateStatus($module); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | private function migrateStatus(Module $module): void |
||
50 | ]); |
||
51 | } |
||
53 |