RouteServiceProvider.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php namespace App\Providers;
  2. use Illuminate\Routing\Router;
  3. use Illuminate\Contracts\Routing\UrlGenerator;
  4. use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
  5. class RouteServiceProvider extends ServiceProvider {
  6. /**
  7. * Called before routes are registered.
  8. *
  9. * Register any model bindings or pattern based filters.
  10. *
  11. * @param Router $router
  12. * @param UrlGenerator $url
  13. * @return void
  14. */
  15. public function before(Router $router, UrlGenerator $url)
  16. {
  17. $url->setRootControllerNamespace('App\Http\Controllers');
  18. }
  19. /**
  20. * Define the routes for the application.
  21. *
  22. * @return void
  23. */
  24. public function map()
  25. {
  26. // Once the application has booted, we will include the default routes
  27. // file. This "namespace" helper will load the routes file within a
  28. // route group which automatically sets the controller namespace.
  29. $this->app->booted(function()
  30. {
  31. $this->namespaced('App\Http\Controllers', function(Router $router)
  32. {
  33. require app_path().'/Http/routes.php';
  34. });
  35. });
  36. }
  37. }