setName('catch-seed:run') ->setDescription('the catch-seed:run command to Run database seeders') ->addArgument('module', Argument::REQUIRED, 'seed the module database') ->addOption('--seed', '-s', InputOption::VALUE_REQUIRED, 'What is the name of the seeder?') ->setHelp(<<catch-seed:run command runs all available or individual seeders php think catch-seed:run module php think catch-seed:run -s UserSeeder php think catch-seed:run -v EOT ); } protected function execute(Input $input, Output $output) { $this->module = strtolower($input->getArgument('module')); $seed = $input->getOption('seed'); // run the seed(ers) $start = microtime(true); $this->seed($seed); $end = microtime(true); $this->seeds = null; $output->writeln('All Done. Took ' . sprintf('%.4fs', $end - $start) . ''); } /** * * 获取 seeder path * @return string * @param $module * @date: 2019/12/10 14:01 */ protected function getPath() { return CatchAdmin::moduleSeedsDirectory($this->module); } }