| 1 | <?php | = | 1 | <?php |
| 2 | 2 | |||
| 3 | namespace App\Providers; | 3 | namespace App\Providers; | |
| 4 | 4 | |||
| 5 | use Illuminate\Support\Facades\Route; | +- | ||
| 6 | use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | = | 5 | use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
| -+ | 6 | use Illuminate\Support\Facades\Route; | ||
| 7 | = | 7 | ||
| 8 | class RouteServiceProvider extends ServiceProvider | 8 | class RouteServiceProvider extends ServiceProvider | |
| 9 | { | 9 | { | |
| 10 | /** | 10 | /** | |
| 11 | * This namespace is applied to your controller routes. | 11 | * This namespace is applied to your controller routes. | |
| 12 | * | 12 | * | |
| 13 | * In addition, it is set as the URL generator's root namespace. | 13 | * In addition, it is set as the URL generator's root namespace. | |
| 14 | * | 14 | * | |
| 15 | * @var string | 15 | * @var string | |
| 16 | */ | 16 | */ | |
| 17 | protected $namespace = 'App\Http\Controllers'; | 17 | protected $namespace = 'App\Http\Controllers'; | |
| -+ | 18 | |||
| 19 | /** | |||
| 20 | * The path to the "home" route for your application. | |||
| 21 | * | |||
| 22 | * @var string | |||
| 23 | */ | |||
| 24 | public const HOME = '/home'; | |||
| 18 | = | 25 | ||
| 19 | /** | 26 | /** | |
| 20 | * Define your route model bindings, pattern filters, etc. | 27 | * Define your route model bindings, pattern filters, etc. | |
| 21 | * | 28 | * | |
| 22 | * @return void | 29 | * @return void | |
| 23 | */ | 30 | */ | |
| 24 | public function boot() | 31 | public function boot() | |
| 25 | { | 32 | { | |
| 26 | // | 33 | // | |
| 27 | 34 | |||
| 28 | parent::boot(); | 35 | parent::boot(); | |
| 29 | } | 36 | } | |
| 30 | 37 | |||
| 31 | /** | 38 | /** | |
| 32 | * Define the routes for the application. | 39 | * Define the routes for the application. | |
| 33 | * | 40 | * | |
| 34 | * @return void | 41 | * @return void | |
| 35 | */ | 42 | */ | |
| 36 | public function map() | 43 | public function map() | |
| 37 | { | 44 | { | |
| 38 | $this->mapApiRoutes(); | 45 | $this->mapApiRoutes(); | |
| 39 | 46 | |||
| 40 | $this->mapWebRoutes(); | 47 | $this->mapWebRoutes(); | |
| 41 | 48 | |||
| 42 | // | 49 | // | |
| 43 | } | 50 | } | |
| 44 | 51 | |||
| 45 | /** | 52 | /** | |
| 46 | * Define the "web" routes for the application. | 53 | * Define the "web" routes for the application. | |
| 47 | * | 54 | * | |
| 48 | * These routes all receive session state, CSRF protection, etc. | 55 | * These routes all receive session state, CSRF protection, etc. | |
| 49 | * | 56 | * | |
| 50 | * @return void | 57 | * @return void | |
| 51 | */ | 58 | */ | |
| 52 | protected function mapWebRoutes() | 59 | protected function mapWebRoutes() | |
| 53 | { | 60 | { | |
| 54 | Route::middleware('web') | 61 | Route::middleware('web') | |
| 55 | ->namespace($this->namespace) | 62 | ->namespace($this->namespace) | |
| 56 | ->group(base_path('routes/web.php')); | 63 | ->group(base_path('routes/web.php')); | |
| 57 | } | 64 | } | |
| 58 | 65 | |||
| 59 | /** | 66 | /** | |
| 60 | * Define the "api" routes for the application. | 67 | * Define the "api" routes for the application. | |
| 61 | * | 68 | * | |
| 62 | * These routes are typically stateless. | 69 | * These routes are typically stateless. | |
| 63 | * | 70 | * | |
| 64 | * @return void | 71 | * @return void | |
| 65 | */ | 72 | */ | |
| 66 | protected function mapApiRoutes() | 73 | protected function mapApiRoutes() | |
| 67 | { | 74 | { | |
| 68 | Route::prefix('api') | 75 | Route::prefix('api') | |
| 69 | ->middleware('api') | 76 | ->middleware('api') | |
| 70 | ->namespace($this->namespace) | 77 | ->namespace($this->namespace) | |
| 71 | ->group(base_path('routes/api.php')); | 78 | ->group(base_path('routes/api.php')); | |
| 72 | } | 79 | } | |
| 73 | } | 80 | } |