diff --git a/src/Install/InstallServiceProvider.php b/src/Install/InstallServiceProvider.php index d4d6dc234..efad97ed5 100644 --- a/src/Install/InstallServiceProvider.php +++ b/src/Install/InstallServiceProvider.php @@ -11,7 +11,7 @@ namespace Flarum\Install; use Flarum\Foundation\AbstractServiceProvider; -use Flarum\Http\GenerateRouteHandlerTrait; +use Flarum\Http\Handler\RouteHandlerFactory; use Flarum\Http\RouteCollection; use Flarum\Install\Prerequisite\Composite; use Flarum\Install\Prerequisite\PhpExtensions; @@ -20,8 +20,6 @@ use Flarum\Install\Prerequisite\WritablePaths; class InstallServiceProvider extends AbstractServiceProvider { - use GenerateRouteHandlerTrait; - /** * {@inheritdoc} */ @@ -51,33 +49,37 @@ class InstallServiceProvider extends AbstractServiceProvider ); $this->app->singleton('flarum.install.routes', function () { - return $this->getRoutes(); + return new RouteCollection; }); $this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install'); } /** - * @return RouteCollection + * {@inheritdoc} */ - protected function getRoutes() + public function boot() { - $routes = new RouteCollection; + $this->populateRoutes($this->app->make('flarum.install.routes')); + } - $toController = $this->getHandlerGenerator($this->app); + /** + * @param RouteCollection $routes + */ + protected function populateRoutes(RouteCollection $routes) + { + $route = $this->app->make(RouteHandlerFactory::class); $routes->get( '/', 'index', - $toController('Flarum\Install\Controller\IndexController') + $route->toController(Controller\IndexController::class) ); $routes->post( '/', 'install', - $toController('Flarum\Install\Controller\InstallController') + $route->toController(Controller\InstallController::class) ); - - return $routes; } } diff --git a/src/Update/UpdateServiceProvider.php b/src/Update/UpdateServiceProvider.php index f225d43d4..9f2bb023e 100644 --- a/src/Update/UpdateServiceProvider.php +++ b/src/Update/UpdateServiceProvider.php @@ -12,6 +12,7 @@ namespace Flarum\Update; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Http\GenerateRouteHandlerTrait; +use Flarum\Http\Handler\RouteHandlerFactory; use Flarum\Http\RouteCollection; class UpdateServiceProvider extends AbstractServiceProvider @@ -24,33 +25,37 @@ class UpdateServiceProvider extends AbstractServiceProvider public function register() { $this->app->singleton('flarum.update.routes', function () { - return $this->getRoutes(); + return new RouteCollection; }); $this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.update'); } /** - * @return RouteCollection + * {@inheritdoc} */ - protected function getRoutes() + public function boot() { - $routes = new RouteCollection; + $this->populateRoutes($this->app->make('flarum.install.routes')); + } - $toController = $this->getHandlerGenerator($this->app); + /** + * @param RouteCollection $routes + */ + protected function populateRoutes(RouteCollection $routes) + { + $route = $this->app->make(RouteHandlerFactory::class); $routes->get( '/', 'index', - $toController('Flarum\Update\Controller\IndexController') + $route->toController(Controller\IndexController::class) ); $routes->post( '/', 'update', - $toController('Flarum\Update\Controller\UpdateController') + $route->toController(Controller\UpdateController::class) ); - - return $routes; } }