RouteServiceProvider.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. }
  38. protected function mapOfficialAccountRoutes(Router $router)
  39. {
  40. $router->group([
  41. 'middleware' => 'web',
  42. ], function ($router) {
  43. require app_path('Http/Routes/Wap/OfficialAccountRoutes.php');
  44. });
  45. $router->group([
  46. 'middleware' => 'wap',
  47. ], function ($router) {
  48. require app_path('Http/Routes/Wechat/OfficialAccountRoutes.php');
  49. });
  50. }
  51. /**
  52. * h5路由
  53. * @param Router $router
  54. */
  55. protected function mapWapRoutes(Router $router)
  56. {
  57. $router->group([
  58. 'middleware' => 'wap',
  59. ], function ($router) {
  60. require app_path('Http/Routes/Wap/WapRoutes.php');
  61. });
  62. }
  63. //UI界面
  64. protected function mapWebRoutes(Router $router)
  65. {
  66. $router->group([
  67. 'middleware' => 'web',
  68. ], function ($router) {
  69. require app_path('Http/Routes/WapBrower/WebRoutes.php');
  70. });
  71. }
  72. /**
  73. * 小程序路由
  74. * @param Router $router
  75. */
  76. protected function mapXchengyuRoutes(Router $router){
  77. $router->group([
  78. 'middleware' => 'web',
  79. ], function ($router) {
  80. require app_path('Http/Routes/Xchengxu/XchengxuRoutes.php');
  81. });
  82. }
  83. }