One of the big learning curves for creating Laravel projects is working with routes and how to organize everything in your project. Today's post is going to look at just this problem.

So let's say that you have a marketing site for your project. It would make sense to place your routes for your marketing site in app/marketing/routes.php. Then in your app/routes.php file just add require_once app_path().'/marketing/routes.php';.

This moves some things out of the way, but we can do a bit better.

Lets go in the app/marketing/routes.php file and wrap everything in a route group to help and make our calls to HTML::route() namespaced nicely.

Route::group(array(), function()
{
    $namespace = 'marketing.';

    Route::get('/', array('as' => $namespace.'home', 'uses' => 'Marketing@index'));
    // More routes using 'as' => $namespace.
});

Unfortunately, there isn't a great way to make this namespacing pass through for Route::resource() routes. But hopefully we can begin to troubleshoot a shim around this or modify the way the router works with resource attributes.