API: Populate default routes only when they are resolved

Refs #1708.
This commit is contained in:
Franz Liedke 2018-12-18 10:33:01 +01:00
parent 565131e2a7
commit 54503d2c29
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -43,6 +43,10 @@ class ApiServiceProvider extends AbstractServiceProvider
return new RouteCollection;
});
$this->app->afterResolving('flarum.api.routes', function (RouteCollection $routes) {
$this->populateRoutes($routes);
});
$this->app->singleton('flarum.api.middleware', function (Application $app) {
$pipe = new MiddlewarePipe;
@ -90,8 +94,6 @@ class ApiServiceProvider extends AbstractServiceProvider
*/
public function boot()
{
$this->populateRoutes($this->app->make('flarum.api.routes'));
$this->registerNotificationSerializers();
AbstractSerializeController::setContainer($this->app);