RouteServiceProvider.php 951 B

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