1 | <?php |
||
11 | class RouteServiceProvider extends ServiceProvider |
||
12 | { |
||
13 | /** |
||
14 | * This namespace is applied to your controller routes. |
||
15 | * |
||
16 | * In addition, it is set as the URL generator's root namespace. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $namespace = 'Microboard\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 | |||
31 | $this->mapWebRoutes(); |
||
32 | |||
33 | if (File::exists(base_path('routes/microboard.php'))) { |
||
34 | $this->mapMicroboardRoutes(); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Define the "web" routes for the application. |
||
40 | * |
||
41 | * These routes all receive session state, CSRF protection, etc. |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | protected function mapWebRoutes() |
||
46 | { |
||
47 | Route::prefix(config('microboard.routes.prefix', 'admin')) |
||
48 | ->middleware(['web', Localization::class]) |
||
49 | ->namespace($this->namespace) |
||
50 | ->group(__DIR__ . '/../../routes/web.php'); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Define the "Microboard" routes for the application. |
||
55 | * |
||
56 | * These routes all receive session state, CSRF protection, etc. |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | protected function mapMicroboardRoutes() |
||
71 | |||
72 | /** |
||
73 | * Define the "api" routes for the application. |
||
74 | * |
||
75 | * These routes are typically stateless. |
||
76 | * |
||
77 | * @return void |
||
78 | */ |
||
79 | protected function mapApiRoutes() |
||
80 | { |
||
81 | Route::prefix(config('microboard.routes.prefix', 'admin') . '/api') |
||
82 | ->middleware(config('microboard.routes.apiMiddleware', [])) |
||
83 | ->name('microboard.api.') |
||
84 | ->namespace($this->namespace) |
||
85 | ->group(__DIR__ . '/../../routes/api.php'); |
||
86 | } |
||
87 | |||
88 | public function register() |
||
92 | } |
||
93 |