Skip to content

Instantly share code, notes, and snippets.

@milon
Created February 16, 2016 02:05
Show Gist options
  • Select an option

  • Save milon/d3ff4faf93f521439c9f to your computer and use it in GitHub Desktop.

Select an option

Save milon/d3ff4faf93f521439c9f to your computer and use it in GitHub Desktop.
Laravel Route Example
<?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
protected $webNamespace = 'App\Http\Controllers\Web';
protected $apiNamespace = 'App\Http\Controllers\Api';
public function boot(Router $router)
{
parent::boot($router);
}
public function map(Router $router)
{
$router->group(['namespace' => $this->webNamespace], function ($router) {
require app_path('Http/web_routes.php');
});
$router->group(['namespace' => $this->apiNamespace], function ($router) {
require app_path('Http/api_routes.php');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment