RouteServiceProvider.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Cache\RateLimiting\Limit;
  4. use Illuminate\Support\Facades\Route;
  5. use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  6. use Illuminate\Http\Request;
  7. use Illuminate\Support\Facades\RateLimiter;
  8. class RouteServiceProvider extends ServiceProvider
  9. {
  10. /**
  11. * This namespace is applied to your controller routes.
  12. *
  13. * In addition, it is set as the URL generator's root namespace.
  14. *
  15. * @var string
  16. */
  17. protected $namespace = null;
  18. /**
  19. * Define your route model bindings, pattern filters, etc.
  20. *
  21. * @return void
  22. */
  23. public function boot()
  24. {
  25. //
  26. parent::boot();
  27. $this->configureRateLimiting();
  28. }
  29. /**
  30. * Define the routes for the application.
  31. *
  32. * @return void
  33. */
  34. public function map()
  35. {
  36. $this->mapApiRoutes();
  37. $this->mapAdminRoutes();
  38. $this->mapSellerRoutes();
  39. $this->mapAffiliateRoutes();
  40. $this->mapRefundRoutes();
  41. $this->mapClubPointsRoutes();
  42. $this->mapOtpRoutes();
  43. $this->mapOfflinePaymentRoutes();
  44. $this->mapAfricanPaymentGatewayRoutes();
  45. $this->mapPaytmRoutes();
  46. $this->mapPosRoutes();
  47. $this->mapSellerPackageRoutes();
  48. $this->mapDeliveryBoyRoutes();
  49. $this->mapAuctionRoutes();
  50. $this->mapWholesaleRoutes();
  51. $this->mapWebRoutes();
  52. $this->mapSalesmanRoutes();
  53. // $this->mapInstallRoutes();
  54. //$this->mapUpdateRoutes();
  55. }
  56. /**
  57. * Define the "b2b" routes for the application.
  58. *
  59. * These routes all receive session state, CSRF protection, etc.
  60. *
  61. * @return void
  62. */
  63. protected function mapWholesaleRoutes()
  64. {
  65. Route::middleware('web')
  66. ->namespace($this->namespace)
  67. ->group(base_path('routes/wholesale.php'));
  68. }
  69. /**
  70. * Define the "delivery boy" routes for the application.
  71. *
  72. * These routes all receive session state, CSRF protection, etc.
  73. *
  74. * @return void
  75. */
  76. protected function mapDeliveryBoyRoutes()
  77. {
  78. Route::middleware('web')
  79. ->namespace($this->namespace)
  80. ->group(base_path('routes/delivery_boy.php'));
  81. }
  82. /**
  83. * Define the "auction" routes for the application.
  84. *
  85. * These routes all receive session state, CSRF protection, etc.
  86. *
  87. * @return void
  88. */
  89. protected function mapAuctionRoutes()
  90. {
  91. Route::middleware('web')
  92. ->namespace($this->namespace)
  93. ->group(base_path('routes/auction.php'));
  94. }
  95. /**
  96. * Define the "seller package" routes for the application.
  97. *
  98. * These routes all receive session state, CSRF protection, etc.
  99. *
  100. * @return void
  101. */
  102. protected function mapSellerPackageRoutes()
  103. {
  104. Route::middleware('web')
  105. ->namespace($this->namespace)
  106. ->group(base_path('routes/seller_package.php'));
  107. }
  108. /**
  109. * Define the "affiliate" routes for the application.
  110. *
  111. * These routes all receive session state, CSRF protection, etc.
  112. *
  113. * @return void
  114. */
  115. protected function mapAffiliateRoutes()
  116. {
  117. Route::middleware('web')
  118. ->namespace($this->namespace)
  119. ->group(base_path('routes/affiliate.php'));
  120. }
  121. /**
  122. * Define the "offline payment" routes for the application.
  123. *
  124. * These routes all receive session state, CSRF protection, etc.
  125. *
  126. * @return void
  127. */
  128. protected function mapOfflinePaymentRoutes()
  129. {
  130. Route::middleware('web')
  131. ->namespace($this->namespace)
  132. ->group(base_path('routes/offline_payment.php'));
  133. }
  134. /**
  135. * Define the "offline payment" routes for the application.
  136. *
  137. * These routes all receive session state, CSRF protection, etc.
  138. *
  139. * @return void
  140. */
  141. protected function mapPaytmRoutes()
  142. {
  143. Route::middleware('web')
  144. ->namespace($this->namespace)
  145. ->group(base_path('routes/paytm.php'));
  146. }
  147. /**
  148. * Define the "offline payment" routes for the application.
  149. *
  150. * These routes all receive session state, CSRF protection, etc.
  151. *
  152. * @return void
  153. */
  154. protected function mapAfricanPaymentGatewayRoutes()
  155. {
  156. Route::middleware('web')
  157. ->namespace($this->namespace)
  158. ->group(base_path('routes/african_pg.php'));
  159. }
  160. /**
  161. * Define the "refund" routes for the application.
  162. *
  163. * These routes all receive session state, CSRF protection, etc.
  164. *
  165. * @return void
  166. */
  167. protected function mapRefundRoutes()
  168. {
  169. Route::middleware('web')
  170. ->namespace($this->namespace)
  171. ->group(base_path('routes/refund_request.php'));
  172. }
  173. /**
  174. * Define the "club points" routes for the application.
  175. *
  176. * These routes all receive session state, CSRF protection, etc.
  177. *
  178. * @return void
  179. */
  180. protected function mapClubPointsRoutes()
  181. {
  182. Route::middleware('web')
  183. ->namespace($this->namespace)
  184. ->group(base_path('routes/club_points.php'));
  185. }
  186. /**
  187. * Define the "OTP System" routes for the application.
  188. *
  189. * These routes all receive session state, CSRF protection, etc.
  190. *
  191. * @return void
  192. */
  193. protected function mapOtpRoutes()
  194. {
  195. Route::middleware('web')
  196. ->namespace($this->namespace)
  197. ->group(base_path('routes/otp.php'));
  198. }
  199. /**
  200. * Define the "POS System" routes for the application.
  201. *
  202. * These routes all receive session state, CSRF protection, etc.
  203. *
  204. * @return void
  205. */
  206. protected function mapPosRoutes()
  207. {
  208. Route::middleware('web')
  209. ->namespace($this->namespace)
  210. ->group(base_path('routes/pos.php'));
  211. }
  212. /**
  213. * Define the "updating" routes for the application.
  214. *
  215. * These routes all receive session state, CSRF protection, etc.
  216. *
  217. * @return void
  218. */
  219. protected function mapUpdateRoutes()
  220. {
  221. Route::middleware('web')
  222. ->namespace($this->namespace)
  223. ->group(base_path('routes/update.php'));
  224. }
  225. /**
  226. * Define the "installation" routes for the application.
  227. *
  228. * These routes all receive session state, CSRF protection, etc.
  229. *
  230. * @return void
  231. */
  232. protected function mapInstallRoutes()
  233. {
  234. Route::middleware('web')
  235. ->namespace($this->namespace)
  236. ->group(base_path('routes/install.php'));
  237. }
  238. /**
  239. * Define the "web" routes for the application.
  240. *
  241. * These routes all receive session state, CSRF protection, etc.
  242. *
  243. * @return void
  244. */
  245. protected function mapWebRoutes()
  246. {
  247. Route::middleware('web')
  248. ->namespace($this->namespace)
  249. ->group(base_path('routes/web.php'));
  250. }
  251. /**
  252. * Define the "admin" routes for the application.
  253. *
  254. * These routes all receive session state, CSRF protection, etc.
  255. *
  256. * @return void
  257. */
  258. protected function mapAdminRoutes()
  259. {
  260. Route::middleware('web')
  261. ->namespace($this->namespace)
  262. ->group(base_path('routes/admin.php'));
  263. }
  264. /**
  265. * Define the "seller" routes for the application.
  266. *
  267. * These routes all receive session state, CSRF protection, etc.
  268. *
  269. * @return void
  270. */
  271. protected function mapSellerRoutes()
  272. {
  273. Route::middleware('web')
  274. ->namespace($this->namespace)
  275. ->group(base_path('routes/seller.php'));
  276. }
  277. /**
  278. * Define the "api" routes for the application.
  279. *
  280. * These routes are typically stateless.
  281. *
  282. * @return void
  283. */
  284. protected function mapApiRoutes()
  285. {
  286. Route::prefix('api')
  287. ->middleware('api')
  288. ->namespace($this->namespace)
  289. ->group(base_path('routes/api.php'));
  290. }
  291. /**
  292. * Configure the rate limiters for the application.
  293. *
  294. * @return void
  295. */
  296. protected function configureRateLimiting()
  297. {
  298. RateLimiter::for('api', function (Request $request) {
  299. return Limit::perMinute(600)->by(optional($request->user())->id ?: $request->ip());
  300. });
  301. }
  302. /**
  303. * Define the "salesman" routes for the application.
  304. *
  305. * These routes all receive session state, CSRF protection, etc.
  306. *
  307. * @return void
  308. */
  309. protected function mapSalesmanRoutes()
  310. {
  311. Route::middleware('web')
  312. ->namespace($this->namespace)
  313. ->group(base_path('routes/salesman.php'));
  314. }
  315. }