Completed
Push — master ( 5021ae...be2f55 )
by he
08:00
created

RouteServiceProvider::map()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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