1 | <?php |
||
2 | |||
3 | namespace Rawilk\LaravelModules\Commands\Other; |
||
4 | |||
5 | use Illuminate\Console\Command; |
||
6 | |||
7 | class UpdateCommand extends Command |
||
8 | { |
||
9 | /** @var string */ |
||
10 | protected $signature = 'module:update |
||
11 | {module? : The name of the module to update}'; |
||
12 | |||
13 | /** @var string */ |
||
14 | protected $description = 'Update dependencies for a specific module or all modules.'; |
||
15 | |||
16 | public function handle(): void |
||
17 | { |
||
18 | if ($name = $this->argument('module')) { |
||
19 | $this->updateModule($name); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
20 | |||
21 | return; |
||
22 | } |
||
23 | |||
24 | /** @var \Rawilk\LaravelModules\Module $module */ |
||
25 | foreach ($this->laravel['modules']->getOrdered() as $module) { |
||
26 | $this->updateModule($module->getName()); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | private function updateModule(string $name): void |
||
31 | { |
||
32 | $this->line("Updating module: <info>{$name}</info>"); |
||
33 | |||
34 | $this->laravel['modules']->update($name); |
||
35 | |||
36 | $this->info("Module [{$name}] updated successfully."); |
||
37 | } |
||
38 | } |
||
39 |