1
0
mirror of https://github.com/flarum/core.git synced 2025-10-13 07:54:25 +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

@@ -17,6 +17,7 @@ use Flarum\Extension\Event\Enabled;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\RouteCollection;
use Flarum\Http\RouteHandlerFactory;
use Flarum\Http\UrlGenerator;
use Flarum\Settings\Event\Saved;
class ForumServiceProvider extends AbstractServiceProvider
@@ -26,8 +27,8 @@ class ForumServiceProvider extends AbstractServiceProvider
*/
public function register()
{
$this->app->singleton(UrlGenerator::class, function () {
return new UrlGenerator($this->app, $this->app->make('flarum.forum.routes'));
$this->app->extend(UrlGenerator::class, function (UrlGenerator $url) {
return $url->addCollection('forum', $this->app->make('flarum.forum.routes'));
});
$this->app->singleton('flarum.forum.routes', function () {