RouteServiceProvider.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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->mapMobileRoutes();
  35. $this->mapStatisticsRoutes();
  36. $this->mapJkqRootes();
  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. protected function mapMobileRoutes()
  66. {
  67. Route::prefix('mobile')
  68. ->middleware(['web', 'mobile'])
  69. ->namespace($this->namespace)
  70. ->group(base_path('routes/mobile.php'));
  71. }
  72. protected function mapStatisticsRoutes()
  73. {
  74. Route::prefix('statistics')
  75. ->middleware('web')
  76. ->namespace($this->namespace)
  77. ->group(base_path('routes/statistics.php'));
  78. }
  79. protected function mapJkqRootes()
  80. {
  81. Route::prefix('jkq')
  82. ->middleware('web')
  83. ->namespace($this->namespace)
  84. ->group(base_path('routes/jkq.php'));
  85. }
  86. }