From 9ec043ba34d9baa294bf4c392f89ce7ee428b6bc Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Thu, 2 Jul 2020 14:22:02 +0800 Subject: [PATCH] =?UTF-8?q?catchConsole=E5=8A=A0=E5=85=A5=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E6=8F=90=E9=AB=98=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/CatchAdminService.php | 6 +++++- extend/catcher/ModuleService.php | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/extend/catcher/CatchAdminService.php b/extend/catcher/CatchAdminService.php index edef1c5..6f40ca0 100644 --- a/extend/catcher/CatchAdminService.php +++ b/extend/catcher/CatchAdminService.php @@ -62,7 +62,11 @@ class CatchAdminService extends Service */ 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()); } /** * diff --git a/extend/catcher/ModuleService.php b/extend/catcher/ModuleService.php index 840931d..e9f9149 100644 --- a/extend/catcher/ModuleService.php +++ b/extend/catcher/ModuleService.php @@ -55,10 +55,11 @@ abstract class ModuleService extends Service if (method_exists($this,'loadCommands')) { list($namespace, $path) = $this->loadCommands(); - $this->commands((new CatchConsole($this->app)) - ->setNamespace($namespace) - ->path($path) - ->commands()); + $catchConsole = $this->app['catch_console']; + + $this->commands($catchConsole->setNamespace($namespace) + ->path($path) + ->commands()); } }