diff --git a/framework/core/src/Admin/AdminServiceProvider.php b/framework/core/src/Admin/AdminServiceProvider.php index ea727c2f0..2bed0a017 100644 --- a/framework/core/src/Admin/AdminServiceProvider.php +++ b/framework/core/src/Admin/AdminServiceProvider.php @@ -44,6 +44,10 @@ class AdminServiceProvider extends AbstractServiceProvider return new RouteCollection; }); + $this->app->afterResolving('flarum.admin.routes', function (RouteCollection $routes) { + $this->populateRoutes($routes); + }); + $this->app->singleton('flarum.admin.middleware', function (Application $app) { $pipe = new MiddlewarePipe; @@ -103,8 +107,6 @@ class AdminServiceProvider extends AbstractServiceProvider */ public function boot() { - $this->populateRoutes($this->app->make('flarum.admin.routes')); - $this->loadViewsFrom(__DIR__.'/../../views', 'flarum.admin'); $events = $this->app->make('events'); diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php index 94ee49d5b..93787cf93 100644 --- a/framework/core/src/Forum/ForumServiceProvider.php +++ b/framework/core/src/Forum/ForumServiceProvider.php @@ -49,6 +49,10 @@ class ForumServiceProvider extends AbstractServiceProvider return new RouteCollection; }); + $this->app->afterResolving('flarum.forum.routes', function (RouteCollection $routes) { + $this->populateRoutes($routes); + }); + $this->app->singleton('flarum.forum.middleware', function (Application $app) { $pipe = new MiddlewarePipe; @@ -110,8 +114,6 @@ class ForumServiceProvider extends AbstractServiceProvider */ public function boot() { - $this->populateRoutes($this->app->make('flarum.forum.routes')); - $this->loadViewsFrom(__DIR__.'/../../views', 'flarum.forum'); $this->app->make('view')->share([