Completed
Pull Request — master (#47)
by Şəhriyar
16:11
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 15
    public function boot()
21
    {
22 15
        app('router')->patterns([
23 15
            'provider' => 'twitter|google|facebook',
24
            'token' => '[a-zA-Z0-9-]+'
25
        ]);
26
27 15
        parent::boot();
28 15
    }
29
30
    /**
31
     * Define the routes for the application.
32
     */
33 15
    public function map()
34
    {
35 15
        $this->mapApiRoutes();
36 15
        $this->mapWebRoutes();
37 15
    }
38
39
    /**
40
     * Define the "api" routes for the application.
41
     * These routes are typically stateless.
42
     *
43
     * @return void
44
     */
45 15
    protected function mapApiRoutes()
46
    {
47 15
        app('router')->prefix('api/v1')->middleware('api')->namespace($this->namespace)->group(base_path('routes/api.php'));
48 15
    }
49
50
    /**
51
     * Define the "web" routes for the application.
52
     * These routes all receive session state, CSRF protection, etc.
53
     *
54
     * @return void
55
     */
56 15
    protected function mapWebRoutes()
57
    {
58 15
        app('router')->middleware('web')->namespace($this->namespace)->group(base_path('routes/web.php'));
59 15
    }
60
}
61