diff --git a/src/Service.php b/src/Service.php index 1777f14..d813429 100644 --- a/src/Service.php +++ b/src/Service.php @@ -1,30 +1,33 @@ - -// +---------------------------------------------------------------------- -namespace think\app; - -use think\Service as BaseService; - -class Service extends BaseService -{ - public function register() - { - $this->app->middleware->unshift(MultiApp::class); - - $this->commands([ - 'build' => command\Build::class, - 'clear' => command\Clear::class, - ]); - - $this->app->bind([ - 'think\route\Url' => Url::class, - ]); - } -} + +// +---------------------------------------------------------------------- +namespace think\app; + +use think\facade\Event; +use think\Service as BaseService; + +class Service extends BaseService +{ + public function register() + { + Event::listen('HttpRun', function () { + $this->app->middleware->add(MultiApp::class); + }); + + $this->commands([ + 'build' => command\Build::class, + 'clear' => command\Clear::class, + ]); + + $this->app->bind([ + 'think\route\Url' => Url::class, + ]); + } +}