From 1169e4aca64f7ae0d932642a2d38ede7a5771d3b Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Tue, 30 Jul 2019 00:56:29 +0200 Subject: [PATCH] Determine default route after extensions Fixes #1819. --- framework/core/src/Forum/ForumServiceProvider.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php index 56edb7132..969edb06d 100644 --- a/framework/core/src/Forum/ForumServiceProvider.php +++ b/framework/core/src/Forum/ForumServiceProvider.php @@ -53,6 +53,10 @@ class ForumServiceProvider extends AbstractServiceProvider return $routes; }); + $this->app->afterResolving('flarum.forum.routes', function (RouteCollection $routes) { + $this->setDefaultRoute($routes); + }); + $this->app->singleton('flarum.forum.middleware', function (Application $app) { $pipe = new MiddlewarePipe; @@ -181,7 +185,16 @@ class ForumServiceProvider extends AbstractServiceProvider $this->app->make('events')->fire( new ConfigureForumRoutes($routes, $factory) ); + } + /** + * Determine the default route. + * + * @param RouteCollection $routes + */ + protected function setDefaultRoute(RouteCollection $routes) + { + $factory = $this->app->make(RouteHandlerFactory::class); $defaultRoute = $this->app->make('flarum.settings')->get('default_route'); if (isset($routes->getRouteData()[0]['GET'][$defaultRoute])) {