RouteServiceProvider::map()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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
    protected $apiNamespace = 'App\Http\Controllers\Api';
20
21
    /**
22
     * Define your route model bindings, pattern filters, etc.
23
     *
24
     * @return void
25
     */
26
    public function boot()
27
    {
28
        //
29
30
        parent::boot();
31
    }
32
33
    /**
34
     * Define the routes for the application.
35
     *
36
     * @return void
37
     */
38
    public function map()
39
    {
40
        $this->mapApiRoutes();
41
42
        $this->mapWebRoutes();
43
44
        //
45
    }
46
47
    /**
48
     * Define the "web" routes for the application.
49
     *
50
     * These routes all receive session state, CSRF protection, etc.
51
     *
52
     * @return void
53
     */
54
    protected function mapWebRoutes()
55
    {
56
        Route::middleware('web')
57
             ->namespace($this->namespace)
58
             ->group(base_path('routes/web.php'));
59
    }
60
61
    /**
62
     * Define the "api" routes for the application.
63
     *
64
     * These routes are typically stateless.
65
     *
66
     * @return void
67
     */
68
    protected function mapApiRoutes()
69
    {
70
        Route::prefix('api')
71
             ->namespace($this->apiNamespace)
72
             ->group(base_path('routes/api.php'));
73
    }
74
}
75