diff --git a/framework/core/src/Admin/AdminServiceProvider.php b/framework/core/src/Admin/AdminServiceProvider.php index 2bed0a017..f7dcab95a 100644 --- a/framework/core/src/Admin/AdminServiceProvider.php +++ b/framework/core/src/Admin/AdminServiceProvider.php @@ -41,11 +41,9 @@ class AdminServiceProvider extends AbstractServiceProvider }); $this->app->singleton('flarum.admin.routes', function () { - return new RouteCollection; - }); - - $this->app->afterResolving('flarum.admin.routes', function (RouteCollection $routes) { + $routes = new RouteCollection; $this->populateRoutes($routes); + return $routes; }); $this->app->singleton('flarum.admin.middleware', function (Application $app) { diff --git a/framework/core/src/Api/ApiServiceProvider.php b/framework/core/src/Api/ApiServiceProvider.php index d904ec3d9..f3937e7ec 100644 --- a/framework/core/src/Api/ApiServiceProvider.php +++ b/framework/core/src/Api/ApiServiceProvider.php @@ -40,11 +40,9 @@ class ApiServiceProvider extends AbstractServiceProvider }); $this->app->singleton('flarum.api.routes', function () { - return new RouteCollection; - }); - - $this->app->afterResolving('flarum.api.routes', function (RouteCollection $routes) { + $routes = new RouteCollection; $this->populateRoutes($routes); + return $routes; }); $this->app->singleton('flarum.api.middleware', function (Application $app) { diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php index 93787cf93..4a975aa22 100644 --- a/framework/core/src/Forum/ForumServiceProvider.php +++ b/framework/core/src/Forum/ForumServiceProvider.php @@ -46,11 +46,9 @@ class ForumServiceProvider extends AbstractServiceProvider }); $this->app->singleton('flarum.forum.routes', function () { - return new RouteCollection; - }); - - $this->app->afterResolving('flarum.forum.routes', function (RouteCollection $routes) { + $routes = new RouteCollection; $this->populateRoutes($routes); + return $routes; }); $this->app->singleton('flarum.forum.middleware', function (Application $app) {