catchConsole加入容器,提高性能

This commit is contained in:
JaguarJack 2020-07-02 14:22:02 +08:00
parent e51cbc6850
commit 9ec043ba34
2 changed files with 10 additions and 5 deletions

View File

@ -62,7 +62,11 @@ class CatchAdminService extends Service
*/ */
protected function registerCommands(): void protected function registerCommands(): void
{ {
$this->commands((new CatchConsole($this->app))->commands()); $catchConsole = new CatchConsole($this->app);
$this->app->bind('catch_console', $catchConsole);
$this->commands($catchConsole->commands());
} }
/** /**
* *

View File

@ -55,10 +55,11 @@ abstract class ModuleService extends Service
if (method_exists($this,'loadCommands')) { if (method_exists($this,'loadCommands')) {
list($namespace, $path) = $this->loadCommands(); list($namespace, $path) = $this->loadCommands();
$this->commands((new CatchConsole($this->app)) $catchConsole = $this->app['catch_console'];
->setNamespace($namespace)
->path($path) $this->commands($catchConsole->setNamespace($namespace)
->commands()); ->path($path)
->commands());
} }
} }