Completed
Pull Request — master (#47)
by Şəhriyar
33:20
created

RouteServiceProvider::localizeWebRoutes()   B

Complexity

Conditions 9
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 9

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 16
cts 16
cp 1
rs 7.041
c 0
b 0
f 0
cc 9
eloc 15
nc 1
nop 2
crap 9
1
<?php namespace App\Providers;
2
3
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
4
5
class RouteServiceProvider extends ServiceProvider
6
{
7
    /**
8
     * This namespace is applied to the controller routes in your routes file.
9
     * In addition, it is set as the URL generator's root namespace.
10
     *
11
     * @var string
12
     */
13
    protected $namespace = 'App\Http\Controllers';
14
15
    /**
16
     * Define your route model bindings, pattern filters, etc.
17
     *
18
     * @return void
19
     */
20
    public function boot()
21 19
    {
22
        app('router')->patterns([
23 19
            'provider' => 'twitter|google|facebook',
24 19
            'token' => '[a-zA-Z0-9-]+'
25
        ]);
26
27
        parent::boot();
28 19
    }
29 19
30
    /**
31
     * Define the routes for the application.
32
     */
33
    public function map()
34 19
    {
35
        $this->mapApiRoutes();
36 19
        $this->mapWebRoutes();
37 19
    }
38 19
39
    /**
40
     * Define the "api" routes for the application.
41
     * These routes are typically stateless.
42
     *
43
     * @return void
44
     */
45
    protected function mapApiRoutes()
46 19
    {
47
        app('router')->prefix('api/v1')->middleware('api')->namespace($this->namespace)->group(base_path('routes/api.php'));
48 19
    }
49 19
50 19
    /**
51 19
     * Define the "web" routes for the application.
52
     * These routes all receive session state, CSRF protection, etc.
53 19
     *
54 19
     * @return void
55 19
     */
56
    protected function mapWebRoutes()
57 19
    {
58 19
        app('router')->middleware('web')->namespace($this->namespace)->group(base_path('routes/web.php'));
59
    }
60
}
61