setName('reset:password') ->addArgument('root', Argument::OPTIONAL, 'root : admin') ->addOption('pwd', null, Option::VALUE_REQUIRED, 'pwd : 123456') ->setDescription('the update resetPwd command'); } /** * @Author:Qinii * @Date: 2020/5/15 * @param Input $input * @param Output $output * @return int|void|null */ protected function execute(Input $input, Output $output) { $account = $input->getArgument('root'); if ($input->hasOption('pwd')){ $pwd = $input->getOption('pwd'); } $this->resetPwd($account,$pwd); } public function resetPwd($account,$pwd) { app()->make(AdminRepository::class)->resetPwd($account,$pwd); } }