Skip to content

Commit

Permalink
Merge pull request laravel#5592 from zoomyboy/6.x
Browse files Browse the repository at this point in the history
[6.x] Add nested resources to route resources
  • Loading branch information
taylorotwell authored Nov 12, 2019
2 parents 08df971 + 403dafc commit 5e5d1dd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Controller Middleware](#controller-middleware)
- [Resource Controllers](#resource-controllers)
- [Partial Resource Routes](#restful-partial-resource-routes)
- [Nested Resources](#restful-nested-resources)
- [Naming Resource Routes](#restful-naming-resource-routes)
- [Naming Resource Route Parameters](#restful-naming-resource-route-parameters)
- [Localizing Resource URIs](#restful-localizing-resource-uris)
Expand Down Expand Up @@ -214,6 +215,15 @@ To quickly generate an API resource controller that does not include the `create

php artisan make:controller API/PhotoController --api

<a name="restful-nested-resources"></a>
### Nested Resources

Sometimes you may need to define routes to a "nested" resource. For example, a photo resource may have multiple "comments" that may be attached to the photo. To "nest" resource controllers, use "dot" notation in your route declaration:

Route::resource('photos.comments', 'PhotoCommentController');

This route will register a "nested" resource that may be accessed with URLs like the following: photos/{photos}/comments/{comments}.

<a name="restful-naming-resource-routes"></a>
### Naming Resource Routes

Expand Down

0 comments on commit 5e5d1dd

Please sign in to comment.