Update text for naming resource route parameters

The text was still referring to the options array that was replaced by fluent declarations with 0fa66a2f4c
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: https://github.com/laravel/framework/issues/19477
This commit is contained in:
Martin Bock 2018-07-29 23:37:23 +02:00 committed by GitHub
parent 30ec4ec767
commit e583227696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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