Initial Commit

This commit is contained in:
Mark Gregory
2026-04-21 09:12:51 +01:00
commit 6bc3c69c3e
151 changed files with 11917 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
<?php
namespace mpba\Modules\Commands;
use Illuminate\Console\Command;
use mpba\Modules\Traits\ModuleCommandTrait;
use Symfony\Component\Console\Input\InputArgument;
class UpdateCommand extends Command
{
use ModuleCommandTrait;
/**
* The console command name.
*
* @var string
*/
protected $name = 'module:update';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update dependencies for the specified module or for all modules.';
/**
* Execute the console command.
*/
public function handle(): int
{
$name = $this->argument('module');
if ($name) {
$this->updateModule($name);
return 0;
}
/** @var \mpba\Modules\Module $module */
foreach ($this->laravel['modules']->getOrdered() as $module) {
$this->updateModule($module->getName());
}
return 0;
}
protected function updateModule($name)
{
$this->line('Running for module: <info>'.$name.'</info>');
$this->laravel['modules']->update($name);
$this->info("Module [{$name}] updated successfully.");
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
['module', InputArgument::OPTIONAL, 'The name of module will be updated.'],
];
}
}