新增 console 统一注入

This commit is contained in:
JaguarJack
2020-07-02 14:01:05 +08:00
parent e35b14a883
commit 26e26b60a7
4 changed files with 118 additions and 22 deletions

View File

@@ -16,15 +16,23 @@ abstract class ModuleService extends Service
{
abstract public function loadRouteFrom();
/**
* 注册
*
* @time 2020年07月02日
* @return void
*/
public function register()
{
$this->app->make('routePath')->loadRouterFrom($this->loadRouteFrom());
$this->registerEvents();
$this->registerCommands();;
}
/**
* 时间注册
* 事件注册
*
* @time 2020年06月24日
* @return void
@@ -36,6 +44,22 @@ abstract class ModuleService extends Service
}
}
/**
* 注册commands
*
* @time 2020年07月02日
* @return void
*/
protected function registerCommands()
{
if (method_exists($this,'loadCommands')) {
list($namespace, $path) = $this->loadCommands();
$this->commands((new CatchConsole($this->app))
->setNamespace($namespace)
->path($path)
->commands());
}
}
}