No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RouteServiceProvider.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  4. use Illuminate\Support\Facades\Route;
  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. protected $apiNamespace ='App\Http\Controllers\Api';
  16. /**
  17. * The path to the "home" route for your application.
  18. *
  19. * @var string
  20. */
  21. public const HOME = '/dashboard';
  22. /**
  23. * Define your route model bindings, pattern filters, etc.
  24. *
  25. * @return void
  26. */
  27. public function boot()
  28. {
  29. //
  30. parent::boot();
  31. }
  32. /**
  33. * Define the routes for the application.
  34. *
  35. * @return void
  36. */
  37. public function map()
  38. {
  39. $this->mapApiRoutes();
  40. $this->mapWebRoutes();
  41. //
  42. }
  43. /**
  44. * Define the "web" routes for the application.
  45. *
  46. * These routes all receive session state, CSRF protection, etc.
  47. *
  48. * @return void
  49. */
  50. protected function mapWebRoutes()
  51. {
  52. Route::middleware('web')
  53. ->namespace($this->namespace)
  54. ->group(base_path('routes/web.php'));
  55. }
  56. /**
  57. * Define the "api" routes for the application.
  58. *
  59. * These routes are typically stateless.
  60. *
  61. * @return void
  62. */
  63. protected function mapApiRoutes()
  64. {
  65. Route::group([
  66. 'middleware' => ['api', 'api_version:v1'],
  67. 'namespace' => "{$this->apiNamespace}\V1",
  68. 'prefix' => 'api/v1',
  69. ], function ($router) {
  70. require base_path('routes/api_v1.php');
  71. });
  72. }
  73. }