RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 74
ccs 24
cts 24
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
A mapWebRoutes() 0 7 1
A map() 0 7 1
A mapApiRoutes() 0 11 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6
use Illuminate\Support\Facades\Route;
7
use Laravel\Passport\Passport;
8
9
class RouteServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * This namespace is applied to your controller routes.
13
     *
14
     * In addition, it is set as the URL generator's root namespace.
15
     *
16
     * @var string
17
     */
18
    protected $namespace = 'App\Http\Controllers';
19
20
    /**
21
     * Define your route model bindings, pattern filters, etc.
22
     *
23
     * @return void
24
     */
25 52
    public function boot()
26
    {
27
        //
28
29 52
        parent::boot();
30 52
    }
31
32
    /**
33
     * Define the routes for the application.
34
     *
35
     * @return void
36
     */
37 52
    public function map()
38
    {
39 52
        $this->mapWebRoutes();
40
41 52
        $this->mapApiRoutes();
42
43 52
        Passport::routes();
44
45
        //
46 52
    }
47
48
    /**
49
     * Define the "web" routes for the application.
50
     *
51
     * These routes all receive session state, CSRF protection, etc.
52
     *
53
     * @return void
54
     */
55 52
    protected function mapWebRoutes()
56
    {
57 52
        Route::group([
58 52
            'middleware' => 'web',
59 52
            'namespace' => $this->namespace,
60 52
        ], function ($router) {
61 52
            require base_path('routes/web.php');
62 52
        });
63 52
    }
64
65
    /**
66
     * Define the "api" routes for the application.
67
     *
68
     * These routes are typically stateless.
69
     *
70
     * @return void
71
     */
72 52
    protected function mapApiRoutes()
73
    {
74
75 52
        Route::group([
76 52
            'middleware' => 'api',
77 52
            'namespace' => $this->namespace,
78 52
            'prefix' => 'api',
79 52
            'as' => 'api.',
80
81 52
        ], function ($router) {
82 52
            require base_path('routes/api.php');
83 52
        });
84 52
    }
85
}
86