RouteServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace PHPHub\Providers;
4
5
use Illuminate\Routing\Router;
6
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
7
8
class RouteServiceProvider extends ServiceProvider
9
{
10
    protected $controller_namespace = 'PHPHub\Http\Controllers';
11
12
    protected $api_controller_namespace = 'PHPHub\Http\ApiControllers';
13
14
    /**
15
     * Define your route model bindings, pattern filters, etc.
16
     *
17
     * @param \Illuminate\Routing\Router $router
18
     */
19
    public function boot(Router $router)
20
    {
21
        //
22
23
        parent::boot($router);
24
    }
25
26
    /**
27
     * Define the routes for the application.
28
     *
29
     * @param \Illuminate\Routing\Router $router
30
     */
31
    public function map(Router $router)
32
    {
33
        $this->configureAPIRoute();
34
35
        $router->group(['namespace' => $this->controller_namespace], function ($router) {
36
            require app_path('Http/routes.php');
37
        });
38
    }
39
40
    /**
41
     * 配置 API 路由.
42
     */
43
    public function configureAPIRoute()
44
    {
45
        $api_router = app('Dingo\Api\Routing\Router');
46
        $api_router->group([
47
            'version'   => env('API_PREFIX'),
48
            'namespace' => $this->api_controller_namespace,
49
        ], function ($router) {
50
            require app_path('Http/api_routes.php');
51
        });
52
    }
53
}
54