RouteServiceProvider.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Support\Facades\Route;
  4. use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  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. * Define your route model bindings, pattern filters, etc.
  17. *
  18. * @return void
  19. */
  20. public function boot()
  21. {
  22. //
  23. parent::boot();
  24. }
  25. /**
  26. * Define the routes for the application.
  27. *
  28. * @return void
  29. */
  30. public function map()
  31. {
  32. $this->mapApiRoutes();
  33. $this->mapWebRoutes();
  34. $this->mapHcApiRoutes();
  35. $this->mapHomeRoutes();
  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::middleware('web')
  48. ->namespace($this->namespace)
  49. ->group(base_path('routes/web.php'));
  50. }
  51. /**
  52. * Define the "api" routes for the application.
  53. *
  54. * These routes are typically stateless.
  55. *
  56. * @return void
  57. */
  58. protected function mapApiRoutes()
  59. {
  60. Route::prefix('api')
  61. ->middleware('api')
  62. ->namespace($this->namespace)
  63. ->group(base_path('routes/api.php'));
  64. }
  65. /**
  66. * Define the "hcapi" routes for the application.
  67. *
  68. * These routes are typically stateless.
  69. *
  70. * @return void
  71. */
  72. protected function mapHcApiRoutes()
  73. {
  74. Route::prefix('hcapi')
  75. ->namespace('App\Api\Controllers')
  76. ->group(base_path('routes/hc_api.php'));
  77. }
  78. /**
  79. * Define the "web" routes for the application.
  80. *
  81. * These routes all receive session state, CSRF protection, etc.
  82. *
  83. * @return void
  84. */
  85. protected function mapHomeRoutes()
  86. {
  87. Route::prefix('Home')
  88. ->middleware('home')
  89. ->namespace('App\Home\Controllers')
  90. ->group(base_path('routes/home.php'));
  91. }
  92. }