From 4cd503746f66a59d55e24d4854145e4bb2318936 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Wed, 19 Dec 2018 21:57:59 +0100 Subject: [PATCH] Shorten registration of routes --- framework/core/src/Admin/AdminServiceProvider.php | 6 ++---- framework/core/src/Api/ApiServiceProvider.php | 6 ++---- framework/core/src/Forum/ForumServiceProvider.php | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) 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) {