summaryrefslogtreecommitdiff
path: root/src/Routing/RoutingServiceProvider.php
blob: 021840c3db68b3567fee2fe880abee8faa2d3b53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

namespace Engelsystem\Routing;

use Engelsystem\Container\ServiceProvider;

class RoutingServiceProvider extends ServiceProvider
{
    public function register()
    {
        $config = $this->app->get('config');
        $class = UrlGenerator::class;
        if (!$config->get('rewrite_urls', true)) {
            $class = LegacyUrlGenerator::class;
        }

        $urlGenerator = $this->app->make($class);
        $this->app->instance('routing.urlGenerator', $urlGenerator);
        $this->app->bind(UrlGeneratorInterface::class, 'routing.urlGenerator');
    }
}