Skip to content

Instantly share code, notes, and snippets.

@mattwells
Created April 14, 2014 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattwells/10684911 to your computer and use it in GitHub Desktop.
Save mattwells/10684911 to your computer and use it in GitHub Desktop.
Nested Routes in Laravel 4
<?php
Route::group(['prefix' => 'forum/{fId}'], function()
{
Route::resource('topic/{tId}', 'TopicController');
});
Route::resource('forum', 'ForumController');
class TopicController extends BaseController
{
public function index($fId, $tId) {
return "Topic ID {$tId} in Forum ID {$fId}";
}
// --- other methods
}
class ForumController extends BaseController
{
public function index($fId)
{
return "Forum ID {$fId}";
}
// --- other methods
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment