Skip to content

Commit

Permalink
Update text for naming resource route parameters
Browse files Browse the repository at this point in the history
The text was still referring to the options array that was replaced by fluent declarations with 0fa66a2
Also, I changed the resource name in the example code for easier understanding of how renaming parameters works. Some people (including me) found the previous resource name to be confusing: laravel/framework#19477
  • Loading branch information
martbock authored Jul 29, 2018
1 parent 30ec4ec commit e583227
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ By default, all resource controller actions have a route name; however, you can
<a name="restful-naming-resource-route-parameters"></a>
### Naming Resource Route Parameters

By default, `Route::resource` will create the route parameters for your resource routes based on the "singularized" version of the resource name. You can easily override this on a per resource basis by passing `parameters` in the options array. The `parameters` array should be an associative array of resource names and parameter names:
By default, `Route::resource` will create the route parameters for your resource routes based on the "singularized" version of the resource name. You can easily override this on a per resource basis by using the `parameters` method. The array passed into the `parameters` method should be an associative array of resource names and parameter names:

Route::resource('user', 'AdminUserController')->parameters([
'user' => 'admin_user'
Route::resource('users', 'AdminUserController')->parameters([
'users' => 'admin_user'
]);

The example above generates the following URIs for the resource's `show` route:

/user/{admin_user}
/users/{admin_user}

<a name="restful-localizing-resource-uris"></a>
### Localizing Resource URIs
Expand Down

0 comments on commit e583227

Please sign in to comment.