优化commands只有在Cli模式下注入

This commit is contained in:
JaguarJack 2020-07-19 08:40:49 +08:00
parent db18e71906
commit 929f9b2a75

View File

@ -43,12 +43,14 @@ class CatchAdminService extends Service
*/ */
protected function registerCommands(): void protected function registerCommands(): void
{ {
if ($this->app->runningInConsole()) {
$catchConsole = new CatchConsole($this->app); $catchConsole = new CatchConsole($this->app);
$this->app->bind('catch_console', $catchConsole); $this->app->bind('catch_console', $catchConsole);
$this->commands($catchConsole->commands()); $this->commands($catchConsole->commands());
} }
}
/** /**
* *
* @time 2019年12月07日 * @time 2019年12月07日