Skip to content

Instantly share code, notes, and snippets.

@IsraelOrtuno
Last active December 9, 2015 23:30
Show Gist options
  • Save IsraelOrtuno/fdb7fc7417525830405b to your computer and use it in GitHub Desktop.
Save IsraelOrtuno/fdb7fc7417525830405b to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Routing patterns.
*
* @var array
*/
protected $patterns = [];
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
// Registering all the preset route patterns
$router->patterns($this->patterns);
parent::boot($router);
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
// Will include every route file found at Http/Routes. If any of these
// files have set a namespace, it will be relative to the namespace
// value preset in this provider. We are now organizing better.
$router->group(['namespace' => $this->namespace], function ($router) {
foreach (\File::allFiles(app_path('Http/Routes')) as $partial) {
require $partial;
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment