setName('create:table') ->addArgument('module', Argument::REQUIRED, 'module name') ->addArgument('table', Argument::REQUIRED, 'table name') ->addOption('form', '-f', Option::VALUE_NONE, '是否需要 form') ->setDescription('cache sensitive word'); } protected function execute(Input $input, Output $output) { $module = $input->getArgument('module'); $table = $input->getArgument('table'); $form = $input->getOption('form'); FileSystem::put( CatchAdmin::moduleDirectory($module) . 'tables' . DIRECTORY_SEPARATOR . (ucwords($table) . '.php'), $this->tableTemp($module, ucwords($table), $form) ); if (! $form) { FileSystem::put( CatchAdmin::moduleDirectory($module) . 'tables' . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . (ucwords($table) . '.php'), $this->formTemp($module, ucwords($table)) ); } $output->info('created success~'); } protected function tableTemp($module, $table, $form) { $_table = lcfirst($table); $formTemp = ! $form ? sprintf('Factory::create(\'%s\');', $_table) : '[];'; return <<getTable('{$_table}'); } protected function form() { // TODO: Implement form() method. return {$formTemp} } } PHP; } protected function formTemp($module, $table) { return <<