RouteServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 56
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
A mapWebRoutes() 0 5 1
A map() 0 5 1
A mapApiRoutes() 0 6 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
class RouteServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * This namespace is applied to your controller routes.
12
     *
13
     * In addition, it is set as the URL generator's root namespace.
14
     *
15
     * @var string
16
     */
17
    protected $namespace = 'App\Http\Controllers';
18
19
    /**
20
     * Define your route model bindings, pattern filters, etc.
21
     */
22
    public function boot()
23
    {
24
        //
25
26
        parent::boot();
27
    }
28
29
    /**
30
     * Define the routes for the application.
31
     */
32
    public function map()
33
    {
34
        $this->mapApiRoutes();
35
36
        $this->mapWebRoutes();
37
38
        //
39
    }
40
41
    /**
42
     * Define the "web" routes for the application.
43
     *
44
     * These routes all receive session state, CSRF protection, etc.
45
     */
46
    protected function mapWebRoutes()
47
    {
48
        Route::middleware('web')
49
            ->namespace($this->namespace)
50
            ->group(base_path('routes/web.php'));
51
    }
52
53
    /**
54
     * Define the "api" routes for the application.
55
     *
56
     * These routes are typically stateless.
57
     */
58
    protected function mapApiRoutes()
59
    {
60
        Route::prefix('api')
61
            ->middleware('api')
62
            ->namespace($this->namespace)
63
            ->group(base_path('routes/api.php'));
64
    }
65
}
66