RouteServiceProvider.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Routing\Router;
  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. * @param \Illuminate\Routing\Router $router
  19. * @return void
  20. */
  21. public function boot()
  22. {
  23. parent::boot();
  24. }
  25. /**
  26. * Define the routes for the application.
  27. *
  28. * @param \Illuminate\Routing\Router $router
  29. * @return void
  30. */
  31. public function map(Router $router)
  32. {
  33. $this->mapOfficialAccountRoutes($router);
  34. $this->mapWapRoutes($router);
  35. $this->mapWebRoutes($router);
  36. $this->mapXchengyuRoutes($router);
  37. $this->mapKuaiYingYongRoutes($router);
  38. }
  39. protected function mapOfficialAccountRoutes(Router $router)
  40. {
  41. $router->group([
  42. 'middleware' => 'web',
  43. ], function ($router) {
  44. require app_path('Http/Routes/Wap/OfficialAccountRoutes.php');
  45. });
  46. $router->group([
  47. 'middleware' => 'wap',
  48. ], function ($router) {
  49. require app_path('Http/Routes/Wechat/OfficialAccountRoutes.php');
  50. });
  51. }
  52. /**
  53. * h5路由
  54. * @param Router $router
  55. */
  56. protected function mapWapRoutes(Router $router)
  57. {
  58. $router->group([
  59. 'middleware' => 'wap',
  60. ], function ($router) {
  61. require app_path('Http/Routes/Wap/WapRoutes.php');
  62. });
  63. }
  64. //UI界面
  65. protected function mapWebRoutes(Router $router)
  66. {
  67. $router->group([
  68. 'middleware' => 'web',
  69. ], function ($router) {
  70. require app_path('Http/Routes/WapBrower/WebRoutes.php');
  71. });
  72. }
  73. /**
  74. * 小程序路由
  75. * @param Router $router
  76. */
  77. protected function mapXchengyuRoutes(Router $router){
  78. $router->group([
  79. 'middleware' => 'web',
  80. ], function ($router) {
  81. require app_path('Http/Routes/Xchengxu/XchengxuRoutes.php');
  82. });
  83. }
  84. /**
  85. * 快应用
  86. */
  87. protected function mapKuaiYingYongRoutes(Router $router)
  88. {
  89. $router->group([
  90. 'middleware' => 'web',
  91. ], function ($router) {
  92. require app_path('Http/Routes/KuaiYingYong/KuaiYingYongRoutes.php');
  93. });
  94. }
  95. }