RouteServiceProvider.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. /**
  16. * Define your route model bindings, pattern filters, etc.
  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->namespace)
  45. ->group(base_path('routes/web-admin.php'));
  46. Route::middleware('web')
  47. ->namespace($this->namespace)
  48. ->group(base_path('routes/web-portfolio.php'));
  49. Route::middleware('web')
  50. ->namespace($this->namespace)
  51. ->group(base_path('routes/web-api.php'));
  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::middleware('api')
  66. ->namespace($this->namespace)
  67. ->group(base_path('routes/api.php'));
  68. }
  69. }