RouteServiceProvider.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Modules\Finance\Providers;
  3. use Illuminate\Support\Facades\Route;
  4. use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  5. class RouteServiceProvider extends ServiceProvider
  6. {
  7. /**
  8. * The module namespace to assume when generating URLs to actions.
  9. *
  10. * @var string
  11. */
  12. protected $moduleNamespace = 'Modules\Finance\Http\Controllers';
  13. /**
  14. * Called before routes are registered.
  15. *
  16. * Register any model bindings or pattern based filters.
  17. *
  18. * @return void
  19. */
  20. public function boot()
  21. {
  22. parent::boot();
  23. }
  24. /**
  25. * Define the routes for the application.
  26. *
  27. * @return void
  28. */
  29. public function map()
  30. {
  31. $this->mapApiRoutes();
  32. $this->mapWebRoutes();
  33. }
  34. /**
  35. * Define the "web" routes for the application.
  36. *
  37. * These routes all receive session state, CSRF protection, etc.
  38. *
  39. * @return void
  40. */
  41. protected function mapWebRoutes()
  42. {
  43. Route::middleware('web')
  44. ->namespace($this->moduleNamespace)
  45. ->group(module_path('Finance', '/Routes/web.php'));
  46. }
  47. /**
  48. * Define the "api" routes for the application.
  49. *
  50. * These routes are typically stateless.
  51. *
  52. * @return void
  53. */
  54. protected function mapApiRoutes()
  55. {
  56. Route::prefix('api')
  57. ->middleware('api')
  58. ->namespace($this->moduleNamespace)
  59. ->group(module_path('Finance', '/Routes/api.php'));
  60. }
  61. }