1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* RouteServiceProvider.php |
7
|
|
|
* Copyright (c) 2020 [email protected] |
8
|
|
|
* |
9
|
|
|
* This file is part of the Firefly III CSV importer |
10
|
|
|
* (https://github.com/firefly-iii/csv-importer). |
11
|
|
|
* |
12
|
|
|
* This program is free software: you can redistribute it and/or modify |
13
|
|
|
* it under the terms of the GNU Affero General Public License as |
14
|
|
|
* published by the Free Software Foundation, either version 3 of the |
15
|
|
|
* License, or (at your option) any later version. |
16
|
|
|
* |
17
|
|
|
* This program is distributed in the hope that it will be useful, |
18
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
19
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20
|
|
|
* GNU Affero General Public License for more details. |
21
|
|
|
* |
22
|
|
|
* You should have received a copy of the GNU Affero General Public License |
23
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
namespace App\Providers; |
27
|
|
|
|
28
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
29
|
|
|
use Illuminate\Support\Facades\Route; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Class RouteServiceProvider |
33
|
|
|
*/ |
34
|
|
|
class RouteServiceProvider extends ServiceProvider |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* This namespace is applied to your controller routes. |
38
|
|
|
* |
39
|
|
|
* In addition, it is set as the URL generator's root namespace. |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $namespace = 'App\Http\Controllers'; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The path to the "home" route for your application. |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
public const HOME = '/home'; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Define the routes for the application. |
54
|
|
|
* |
55
|
|
|
* @return void |
56
|
|
|
*/ |
57
|
|
|
public function map(): void |
58
|
|
|
{ |
59
|
|
|
$this->mapApiRoutes(); |
60
|
|
|
|
61
|
|
|
$this->mapWebRoutes(); |
62
|
|
|
|
63
|
|
|
// |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Define the "web" routes for the application. |
68
|
|
|
* |
69
|
|
|
* These routes all receive session state, CSRF protection, etc. |
70
|
|
|
* |
71
|
|
|
* @return void |
72
|
|
|
*/ |
73
|
|
|
protected function mapWebRoutes(): void |
74
|
|
|
{ |
75
|
|
|
Route::middleware('web') |
76
|
|
|
->namespace($this->namespace) |
77
|
|
|
->group(base_path('routes/web.php')); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Define the "api" routes for the application. |
82
|
|
|
* |
83
|
|
|
* These routes are typically stateless. |
84
|
|
|
* |
85
|
|
|
* @return void |
86
|
|
|
*/ |
87
|
|
|
protected function mapApiRoutes(): void |
88
|
|
|
{ |
89
|
|
|
Route::prefix('api') |
90
|
|
|
->middleware('api') |
91
|
|
|
->namespace($this->namespace) |
92
|
|
|
->group(base_path('routes/api.php')); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|