RouteServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Modules\Example\Providers;
4
5
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6
use Illuminate\Support\Facades\Route;
7
8
class RouteServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * The root namespace to assume when generating URLs to actions.
12
     *
13
     * @var string
14
     */
15
    protected $namespace = 'Modules\Example\Http\Controllers';
16
17
    /**
18
     * Called before routes are registered.
19
     *
20
     * Register any model bindings or pattern based filters.
21
     *
22
     * @return void
23
     */
24
    public function boot()
25
    {
26
        parent::boot();
27
    }
28
29
    /**
30
     * Define the routes for the application.
31
     *
32
     * @return void
33
     */
34
    public function map()
35
    {
36
        $this->mapApiRoutes();
37
38
        $this->mapWebRoutes();
39
40
        $this->mapCommandRoutes();
41
    }
42
43
    /**
44
     * Define the "web" routes for the application.
45
     *
46
     * These routes all receive session state, CSRF protection, etc.
47
     *
48
     * @return void
49
     */
50
    protected function mapWebRoutes()
51
    {
52
        Route::middleware('web')
53
             ->namespace($this->namespace)
54
             ->group(__DIR__.'/../Routes/web.php');
55
    }
56
57
    /**
58
     * Define the "api" routes for the application.
59
     *
60
     * These routes are typically stateless.
61
     *
62
     * @return void
63
     */
64
    protected function mapApiRoutes()
65
    {
66
        Route::prefix('api')
67
             ->middleware('api')
68
             ->namespace($this->namespace)
69
             ->group(__DIR__.'/../Routes/api.php');
70
    }
71
72
    /**
73
     * Define the "console" routes for the application.
74
     *
75
     * These routes are console commands.
76
     *
77
     * @return void
78
     */
79
    protected function mapCommandRoutes()
80
    {
81
        $commands = require __DIR__.'/../Routes/console.php';
82
        $this->commands($commands);
83
    }
84
}
85