Skip to content

Instantly share code, notes, and snippets.

@shaneturner
Created October 8, 2016 07:58
Show Gist options
  • Save shaneturner/9d9980a7c8ecb6328b35aed0335fd2de to your computer and use it in GitHub Desktop.
Save shaneturner/9d9980a7c8ecb6328b35aed0335fd2de to your computer and use it in GitHub Desktop.
Resourceful routing and controller example. With nested relationships.
Route::resource('foo', 'FooController');
// Specific methods for the relation between models
Route::resource('foo.bar', 'Foo\BarController'); // For accessing Bar related with Foo
Route::resource('foo.bar.bez', 'Foo\Bar\BezController'); // For accessing Bez related with Foo and Bar
Route::resource('foo.bar.bez.biz', 'Foo\Bar\Bez\BizController'); // For accessing Biz related with Foo, Bar and Bez
// General methods for each collection/resource
Route::resource('bar', 'BarController'); // For accessing bar
Route::resource('bez', 'BezController'); // For accessing bez
Route::resource('biz', 'BizController'); // For accessing biz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment