1
0
mirror of https://github.com/flarum/core.git synced 2025-07-29 04:30:56 +02:00

Combine URL generator classes into one

This commit is contained in:
Franz Liedke
2017-06-25 23:33:02 +02:00
parent f824dcfb53
commit b72407440d
19 changed files with 104 additions and 111 deletions

View File

@@ -19,6 +19,7 @@ use Flarum\Event\ConfigureNotificationTypes;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\RouteCollection;
use Flarum\Http\RouteHandlerFactory;
use Flarum\Http\UrlGenerator;
use Tobscure\JsonApi\ErrorHandler;
use Tobscure\JsonApi\Exception\Handler\FallbackExceptionHandler;
use Tobscure\JsonApi\Exception\Handler\InvalidParameterExceptionHandler;
@@ -30,8 +31,8 @@ class ApiServiceProvider extends AbstractServiceProvider
*/
public function register()
{
$this->app->singleton(UrlGenerator::class, function () {
return new UrlGenerator($this->app, $this->app->make('flarum.api.routes'));
$this->app->extend(UrlGenerator::class, function (UrlGenerator $url) {
return $url->addCollection('api', $this->app->make('flarum.api.routes'), 'api');
});
$this->app->singleton('flarum.api.routes', function () {