RouteServiceProvider.php 1.6 KB

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