RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 77
rs 10
c 0
b 0
f 0

4 Methods

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