RouteServiceProvider.txt 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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->mapInstallRoutes();
  53. //$this->mapUpdateRoutes();
  54. }
  55. /**
  56. * Define the "b2b" routes for the application.
  57. *
  58. * These routes all receive session state, CSRF protection, etc.
  59. *
  60. * @return void
  61. */
  62. protected function mapWholesaleRoutes()
  63. {
  64. Route::middleware('web')
  65. ->namespace($this->namespace)
  66. ->group(base_path('routes/wholesale.php'));
  67. }
  68. /**
  69. * Define the "delivery boy" routes for the application.
  70. *
  71. * These routes all receive session state, CSRF protection, etc.
  72. *
  73. * @return void
  74. */
  75. protected function mapDeliveryBoyRoutes()
  76. {
  77. Route::middleware('web')
  78. ->namespace($this->namespace)
  79. ->group(base_path('routes/delivery_boy.php'));
  80. }
  81. /**
  82. * Define the "auction" routes for the application.
  83. *
  84. * These routes all receive session state, CSRF protection, etc.
  85. *
  86. * @return void
  87. */
  88. protected function mapAuctionRoutes()
  89. {
  90. Route::middleware('web')
  91. ->namespace($this->namespace)
  92. ->group(base_path('routes/auction.php'));
  93. }
  94. /**
  95. * Define the "seller package" routes for the application.
  96. *
  97. * These routes all receive session state, CSRF protection, etc.
  98. *
  99. * @return void
  100. */
  101. protected function mapSellerPackageRoutes()
  102. {
  103. Route::middleware('web')
  104. ->namespace($this->namespace)
  105. ->group(base_path('routes/seller_package.php'));
  106. }
  107. /**
  108. * Define the "affiliate" routes for the application.
  109. *
  110. * These routes all receive session state, CSRF protection, etc.
  111. *
  112. * @return void
  113. */
  114. protected function mapAffiliateRoutes()
  115. {
  116. Route::middleware('web')
  117. ->namespace($this->namespace)
  118. ->group(base_path('routes/affiliate.php'));
  119. }
  120. /**
  121. * Define the "offline payment" routes for the application.
  122. *
  123. * These routes all receive session state, CSRF protection, etc.
  124. *
  125. * @return void
  126. */
  127. protected function mapOfflinePaymentRoutes()
  128. {
  129. Route::middleware('web')
  130. ->namespace($this->namespace)
  131. ->group(base_path('routes/offline_payment.php'));
  132. }
  133. /**
  134. * Define the "offline payment" routes for the application.
  135. *
  136. * These routes all receive session state, CSRF protection, etc.
  137. *
  138. * @return void
  139. */
  140. protected function mapPaytmRoutes()
  141. {
  142. Route::middleware('web')
  143. ->namespace($this->namespace)
  144. ->group(base_path('routes/paytm.php'));
  145. }
  146. /**
  147. * Define the "offline payment" routes for the application.
  148. *
  149. * These routes all receive session state, CSRF protection, etc.
  150. *
  151. * @return void
  152. */
  153. protected function mapAfricanPaymentGatewayRoutes()
  154. {
  155. Route::middleware('web')
  156. ->namespace($this->namespace)
  157. ->group(base_path('routes/african_pg.php'));
  158. }
  159. /**
  160. * Define the "refund" routes for the application.
  161. *
  162. * These routes all receive session state, CSRF protection, etc.
  163. *
  164. * @return void
  165. */
  166. protected function mapRefundRoutes()
  167. {
  168. Route::middleware('web')
  169. ->namespace($this->namespace)
  170. ->group(base_path('routes/refund_request.php'));
  171. }
  172. /**
  173. * Define the "club points" routes for the application.
  174. *
  175. * These routes all receive session state, CSRF protection, etc.
  176. *
  177. * @return void
  178. */
  179. protected function mapClubPointsRoutes()
  180. {
  181. Route::middleware('web')
  182. ->namespace($this->namespace)
  183. ->group(base_path('routes/club_points.php'));
  184. }
  185. /**
  186. * Define the "OTP System" routes for the application.
  187. *
  188. * These routes all receive session state, CSRF protection, etc.
  189. *
  190. * @return void
  191. */
  192. protected function mapOtpRoutes()
  193. {
  194. Route::middleware('web')
  195. ->namespace($this->namespace)
  196. ->group(base_path('routes/otp.php'));
  197. }
  198. /**
  199. * Define the "POS System" routes for the application.
  200. *
  201. * These routes all receive session state, CSRF protection, etc.
  202. *
  203. * @return void
  204. */
  205. protected function mapPosRoutes()
  206. {
  207. Route::middleware('web')
  208. ->namespace($this->namespace)
  209. ->group(base_path('routes/pos.php'));
  210. }
  211. /**
  212. * Define the "updating" routes for the application.
  213. *
  214. * These routes all receive session state, CSRF protection, etc.
  215. *
  216. * @return void
  217. */
  218. protected function mapUpdateRoutes()
  219. {
  220. Route::middleware('web')
  221. ->namespace($this->namespace)
  222. ->group(base_path('routes/update.php'));
  223. }
  224. /**
  225. * Define the "installation" routes for the application.
  226. *
  227. * These routes all receive session state, CSRF protection, etc.
  228. *
  229. * @return void
  230. */
  231. protected function mapInstallRoutes()
  232. {
  233. Route::middleware('web')
  234. ->namespace($this->namespace)
  235. ->group(base_path('routes/install.php'));
  236. }
  237. /**
  238. * Define the "web" routes for the application.
  239. *
  240. * These routes all receive session state, CSRF protection, etc.
  241. *
  242. * @return void
  243. */
  244. protected function mapWebRoutes()
  245. {
  246. Route::middleware('web')
  247. ->namespace($this->namespace)
  248. ->group(base_path('routes/web.php'));
  249. }
  250. /**
  251. * Define the "admin" routes for the application.
  252. *
  253. * These routes all receive session state, CSRF protection, etc.
  254. *
  255. * @return void
  256. */
  257. protected function mapAdminRoutes()
  258. {
  259. Route::middleware('web')
  260. ->namespace($this->namespace)
  261. ->group(base_path('routes/admin.php'));
  262. }
  263. /**
  264. * Define the "seller" routes for the application.
  265. *
  266. * These routes all receive session state, CSRF protection, etc.
  267. *
  268. * @return void
  269. */
  270. protected function mapSellerRoutes()
  271. {
  272. Route::middleware('web')
  273. ->namespace($this->namespace)
  274. ->group(base_path('routes/seller.php'));
  275. }
  276. /**
  277. * Define the "api" routes for the application.
  278. *
  279. * These routes are typically stateless.
  280. *
  281. * @return void
  282. */
  283. protected function mapApiRoutes()
  284. {
  285. Route::prefix('api')
  286. ->middleware('api')
  287. ->namespace($this->namespace)
  288. ->group(base_path('routes/api.php'));
  289. }
  290. /**
  291. * Configure the rate limiters for the application.
  292. *
  293. * @return void
  294. */
  295. protected function configureRateLimiting()
  296. {
  297. RateLimiter::for('api', function (Request $request) {
  298. return Limit::perMinute(600)->by(optional($request->user())->id ?: $request->ip());
  299. });
  300. }
  301. }