Skip to content

Instantly share code, notes, and snippets.

@EddyF
Last active May 2, 2017 15:22
Show Gist options
  • Save EddyF/df495081495b1d677cfed17f76208fc2 to your computer and use it in GitHub Desktop.
Save EddyF/df495081495b1d677cfed17f76208fc2 to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
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 $apiV1Namespace = 'App\Http\Controllers\v1';
protected $apiV2Namespace = 'App\Http\Controllers\v2';
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function boot(Router $router)
{
//
parent::boot($router);
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function map(Router $router)
{
/*
|--------------------------------------------------------------------------
| v1 API Router
|--------------------------------------------------------------------------
*/
$router->group(['namespace' => $this->apiV1Namespace], function ($router) {
require app_path('Http/routes.v1.php');
});
/*
|--------------------------------------------------------------------------
| v2 Api Router
|--------------------------------------------------------------------------
*/
$router->group(['namespace' => $this->apiV2Namespace], function ($router) {
require app_path('Http/routes.v2.php');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment