Completed
Branch master (a6481d)
by Fèvre
02:12
created

RouteServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

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