1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\Route; |
6
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
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 your route model bindings, pattern filters, etc. |
21
|
|
|
* |
22
|
|
|
* @return void |
23
|
|
|
*/ |
24
|
|
|
public function boot() |
25
|
|
|
{ |
26
|
|
|
Route::pattern('id', '^[1-9][0-9]*$'); |
27
|
|
|
|
28
|
|
|
parent::boot(); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Define the routes for the application. |
33
|
|
|
* |
34
|
|
|
* @return void |
35
|
|
|
*/ |
36
|
|
|
public function map() |
37
|
|
|
{ |
38
|
|
|
$this->mapApiRoutes(); |
39
|
|
|
|
40
|
|
|
$this->mapWebRoutes(); |
41
|
|
|
|
42
|
|
|
$this->mapAdminRoutes(); |
43
|
|
|
|
44
|
|
|
$this->mapMemberRoutes(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Define the "admin" routes for the application. |
49
|
|
|
* |
50
|
|
|
* These routes all receive session state, CSRF protection, etc. |
51
|
|
|
* |
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
|
|
protected function mapAdminRoutes() |
55
|
|
|
{ |
56
|
|
|
Route::prefix('admin') |
57
|
|
|
->middleware('web') |
58
|
|
|
->namespace($this->namespace . '\Admin') |
59
|
|
|
->group(base_path('routes/admin.php')); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Define the "member" routes for the application. |
64
|
|
|
* |
65
|
|
|
* These routes all receive session state, CSRF protection, etc. |
66
|
|
|
* |
67
|
|
|
* @return void |
68
|
|
|
*/ |
69
|
|
|
protected function mapMemberRoutes() |
70
|
|
|
{ |
71
|
|
|
Route::prefix('member') |
72
|
|
|
->middleware('web') |
73
|
|
|
->namespace($this->namespace . '\Front') |
74
|
|
|
->group(base_path('routes/member.php')); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Define the "web" routes for the application. |
79
|
|
|
* |
80
|
|
|
* These routes all receive session state, CSRF protection, etc. |
81
|
|
|
* |
82
|
|
|
* @return void |
83
|
|
|
*/ |
84
|
|
|
protected function mapWebRoutes() |
85
|
|
|
{ |
86
|
|
|
Route::middleware('web') |
87
|
|
|
->namespace($this->namespace . '\Front') |
88
|
|
|
->group(base_path('routes/web.php')); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Define the "api" routes for the application. |
93
|
|
|
* |
94
|
|
|
* These routes are typically stateless. |
95
|
|
|
* |
96
|
|
|
* @return void |
97
|
|
|
*/ |
98
|
|
|
protected function mapApiRoutes() |
99
|
|
|
{ |
100
|
|
|
Route::prefix('api') |
101
|
|
|
->middleware('api') |
102
|
|
|
->namespace($this->namespace) |
103
|
|
|
->group(base_path('routes/api.php')); |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|