request = $request; } /** * 列表. * * @return \Illuminate\Http\Response */ public function call() { $command = $this->request->get('command'); $commands = array_keys(Artisan::all()); if (!in_array($command, $commands)) { throw new NotAllowedException('非法的命令'); } $parameters = $this->request->get('parameters', []); try{ Artisan::call($command, $parameters); }catch(\Exception $e){ throw new HttpException($e->getMessage()); } return res(true, '执行成功'); } }