1
0
mirror of https://github.com/flarum/core.git synced 2025-07-20 08:11:27 +02:00

Shorten registration of routes

This commit is contained in:
Franz Liedke
2018-12-19 21:57:59 +01:00
parent c923d23f32
commit 4cd503746f
3 changed files with 6 additions and 12 deletions

View File

@@ -41,11 +41,9 @@ class AdminServiceProvider extends AbstractServiceProvider
}); });
$this->app->singleton('flarum.admin.routes', function () { $this->app->singleton('flarum.admin.routes', function () {
return new RouteCollection; $routes = new RouteCollection;
});
$this->app->afterResolving('flarum.admin.routes', function (RouteCollection $routes) {
$this->populateRoutes($routes); $this->populateRoutes($routes);
return $routes;
}); });
$this->app->singleton('flarum.admin.middleware', function (Application $app) { $this->app->singleton('flarum.admin.middleware', function (Application $app) {

View File

@@ -40,11 +40,9 @@ class ApiServiceProvider extends AbstractServiceProvider
}); });
$this->app->singleton('flarum.api.routes', function () { $this->app->singleton('flarum.api.routes', function () {
return new RouteCollection; $routes = new RouteCollection;
});
$this->app->afterResolving('flarum.api.routes', function (RouteCollection $routes) {
$this->populateRoutes($routes); $this->populateRoutes($routes);
return $routes;
}); });
$this->app->singleton('flarum.api.middleware', function (Application $app) { $this->app->singleton('flarum.api.middleware', function (Application $app) {

View File

@@ -46,11 +46,9 @@ class ForumServiceProvider extends AbstractServiceProvider
}); });
$this->app->singleton('flarum.forum.routes', function () { $this->app->singleton('flarum.forum.routes', function () {
return new RouteCollection; $routes = new RouteCollection;
});
$this->app->afterResolving('flarum.forum.routes', function (RouteCollection $routes) {
$this->populateRoutes($routes); $this->populateRoutes($routes);
return $routes;
}); });
$this->app->singleton('flarum.forum.middleware', function (Application $app) { $this->app->singleton('flarum.forum.middleware', function (Application $app) {