Files
ABSDEV/Modules/Developer/Console/Commands/MakeModuleCommand.php
T
2026-07-24 14:59:44 +01:00

33 lines
913 B
PHP

<?php
namespace Modules\Developer\Console\Commands;
use Illuminate\Console\Command;
use Modules\Developer\Support\ModuleGenerator;
use Throwable;
final class MakeModuleCommand extends Command
{
protected $signature = 'module:make {name} {--force}';
protected $description = 'Generate a complete modular Laravel module scaffold.';
public function handle(ModuleGenerator $generator): int
{
try {
$files = $generator->generate($this->argument('name'), (bool) $this->option('force'));
} catch (Throwable $e) {
$this->error($e->getMessage());
return self::FAILURE;
}
foreach ($files as $file) {
$this->line("<info>created</info> {$file}");
}
$this->newLine();
$this->info('Enable the module in modules_statuses.json, then run composer dump-autoload.');
return self::SUCCESS;
}
}