addArgument('module', InputArgument::REQUIRED, 'O nome do módulo (ex: blog)') ->addArgument('name', InputArgument::REQUIRED, 'O nome do modelo (ex: Post)'); } protected function execute(InputInterface $input, OutputInterface $output): int { $module = strtolower($input->getArgument('module')); $name = $input->getArgument('name'); $modulePath = dirname(__DIR__, 3) . '/modules/' . $module; if (!is_dir($modulePath)) { $output->writeln("O módulo '{$module}' não existe."); return Command::FAILURE; } $modelsPath = $modulePath . '/classes/Models'; if (!is_dir($modelsPath)) { mkdir($modelsPath, 0755, true); } $filePath = $modelsPath . '/' . $name . '.php'; if (file_exists($filePath)) { $output->writeln("O modelo '{$name}' já existe no módulo '{$module}'."); return Command::FAILURE; } $namespace = "Modules\\" . ucfirst($module) . "\\Models"; $tableName = strtolower(preg_replace('/(?writeln("Modelo '{$name}' criado com sucesso em modules/{$module}/classes/Models/"); return Command::SUCCESS; } else { $output->writeln("Falha ao criar o arquivo do modelo."); return Command::FAILURE; } } }