Skip to content

Commit

Permalink
Fix docs for resource method.
Browse files Browse the repository at this point in the history
By overriding the abilities array in the third parameter, The keys of this array will be concatenated with a period to the resource name in the first argument.

So keys should be `photo` & `image`, not `post.photo` & `post.image`.
  • Loading branch information
mmghv committed Aug 8, 2017
1 parent 151617b commit b31cd70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ This is identical to manually defining the following Gate definitions:
By default, the `view`, `create`, `update`, and `delete` abilities will be defined. You can override the default abilities by passing an array as third argument to the `resource` method. The key of the array defines the name of the ability while the value defines the method name:

Gate::resource('posts', 'PostPolicy', [
'posts.photo' => 'updatePhoto',
'posts.image' => 'updateImage',
'photo' => 'updatePhoto',
'image' => 'updateImage',
]);

<a name="authorizing-actions-via-gates"></a>
Expand Down

0 comments on commit b31cd70

Please sign in to comment.