You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.6 KiB

  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. }
  31. /**
  32. * Define the routes for the application.
  33. *
  34. * @return void
  35. */
  36. public function map()
  37. {
  38. $this->mapApiRoutes();
  39. $this->mapWebRoutes();
  40. //
  41. }
  42. /**
  43. * Define the "web" routes for the application.
  44. *
  45. * These routes all receive session state, CSRF protection, etc.
  46. *
  47. * @return void
  48. */
  49. protected function mapWebRoutes()
  50. {
  51. Route::middleware('web')
  52. ->namespace($this->namespace)
  53. ->group(base_path('routes/web.php'));
  54. }
  55. /**
  56. * Define the "api" routes for the application.
  57. *
  58. * These routes are typically stateless.
  59. *
  60. * @return void
  61. */
  62. protected function mapApiRoutes()
  63. {
  64. Route::prefix('api')
  65. ->middleware('api')
  66. ->namespace($this->namespace)
  67. ->group(base_path('routes/api.php'));
  68. }
  69. }