Completed
Pull Request — master (#91)
by Mahmoud
05:39
created

MainRoutesServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace App\Port\Route\Providers;
4
5
use App\Port\HashId\Traits\HashIdTrait;
6
use App\Port\Loader\Loaders\RoutesLoaderTrait;
7
use App\Port\Route\Abstracts\PortRoutesServiceProviderAbstract;
8
use Dingo\Api\Routing\Router as DingoApiRouter;
9
use Illuminate\Routing\Router as LaravelRouter;
10
11
/**
12
 * Class MainRoutesServiceProvider.
13
 *
14
 * A.K.A app/Providers/RouteServiceProvider.php
15
 *
16
 * @author  Mahmoud Zalt <[email protected]>
17
 */
18
class MainRoutesServiceProvider extends PortRoutesServiceProviderAbstract
19
{
20
21
    use RoutesLoaderTrait;
22
    use HashIdTrait;
23
24
    /**
25
     * This namespace is applied to your controller routes.
26
     *
27
     * In addition, it is set as the URL generator's root namespace.
28
     *
29
     * @var string
30
     */
31
    protected $namespace;
32
33
    /**
34
     * Instance of the Laravel default Router Class
35
     *
36
     * @var \Illuminate\Routing\Router
37
     */
38
    private $webRouter;
39
40
    /**
41
     * Instance of the Dingo Api router.
42
     *
43
     * @var \Dingo\Api\Routing\Router
44
     */
45
    public $apiRouter;
46
47
    /**
48
     * Define your route model bindings, pattern filters, etc.
49
     */
50
    public function boot()
51
    {
52
        // initializing an instance of the Dingo Api router
53
        $this->apiRouter = app(DingoApiRouter::class);
54
55
        parent::boot();
56
    }
57
58
    /**
59
     * Define the routes for the application.
60
     *
61
     * @param \Illuminate\Routing\Router $webRouterParam
62
     */
63
    public function map(LaravelRouter $webRouterParam)
64
    {
65
        $this->webRouter = $webRouterParam;
66
67
        $this->runRoutesAutoLoader();
68
69
        $this->runEndpointsHashedIdsDecoder();
70
    }
71
72
}
73