Completed
Pull Request — dev (#315)
by Alies
04:47
created

RouteServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A mapApiRoutes() 0 5 1
A mapWidgetRoutes() 0 6 1
A mapDashboardRoutes() 0 11 1
A mapRedirectRoutes() 0 5 1
A map() 0 6 1
1
<?php
2
3
namespace Diglabby\Doika\Providers;
4
5
use App\Providers\RouteServiceProvider as BasicRouteServiceProvider;
6
use Illuminate\Support\Facades\Route;
7
8
final class RouteServiceProvider extends BasicRouteServiceProvider
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 = 'Diglabby\Doika\Http\Controllers';
18
19
    /** @var string */
20
    protected $laravelNamespace = 'App\Http\Controllers';
21
22
    /**
23
     * Define the routes for the application.
24
     *
25
     * @return void
26
     */
27
    public function map()
28
    {
29
        $this->mapApiRoutes();
30
        $this->mapWidgetRoutes();
31
        $this->mapDashboardRoutes();
32
        $this->mapRedirectRoutes();
33
    }
34
35
    protected function mapApiRoutes()
36
    {
37
        Route::middleware('api')
38
            ->namespace($this->namespace)
39
            ->group(base_path('routes/api.php'));
40
    }
41
42
    protected function mapWidgetRoutes()
43
    {
44
        Route::middleware('web')
45
            ->prefix('doika')
46
            ->namespace($this->namespace)
47
            ->group(base_path('routes/widget.php'));
48
    }
49
50
    protected function mapDashboardRoutes()
51
    {
52
        Route::middleware(['web'])
53
            ->prefix('doika/dashboard/')
54
            ->namespace($this->laravelNamespace)
55
            ->group(base_path('routes/auth.php'));
56
57
        Route::middleware(['web', 'auth'])
58
            ->prefix('doika/dashboard/')
59
            ->namespace($this->namespace)
60
            ->group(base_path('routes/dashboard.php'));
61
    }
62
63
    protected function mapRedirectRoutes()
64
    {
65
        Route::middleware(['web'])
66
            ->namespace($this->namespace)
67
            ->group(base_path('routes/redirects.php'));
68
    }
69
}
70