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

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

View File

@ -43,11 +43,13 @@ class CatchAdminService extends Service
*/ */
protected function registerCommands(): void protected function registerCommands(): void
{ {
$catchConsole = new CatchConsole($this->app); if ($this->app->runningInConsole()) {
$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());
}
} }
/** /**
* *