Passed
Push — master ( f3f38a...1d9f9e )
by Frédéric
02:04
created

LocaleRouteServiceProvider::aliasMiddleware()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CaribouFute\LocaleRoute;
4
5
use CaribouFute\LocaleRoute\Middleware\SetSessionLocale;
6
use CaribouFute\LocaleRoute\Prefix\Route as PrefixRoute;
7
use CaribouFute\LocaleRoute\Routing\LocaleRouter;
8
use Illuminate\Routing\Router;
9
use Illuminate\Support\ServiceProvider;
10
11
class LocaleRouteServiceProvider extends ServiceProvider
12
{
13
    protected $defer = false;
14
15
    public function boot(Router $router)
16
    {
17
        $this->publishes([__DIR__ . '/config/localeroute.php' => config_path('localeroute.php')]);
18
        $this->mergeConfigFrom(__DIR__ . '/config/localeroute.php', 'localeroute');
19
20
        $router->aliasMiddleware('locale.session', SetSessionLocale::class);
21
    }
22
23
    public function register()
24
    {
25
        $this->app->bind('locale-route', LocaleRouter::class);
26
        $this->app->bind('locale-route-url', PrefixRoute::class);
27
28
        config('config/localeroute.php');
29
    }
30
}
31