23 lines
838 B
PHP
23 lines
838 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;
|
|
}
|
|
}
|