Skip to content

Commit b31cd70

Browse files
authored
Fix docs for resource method.
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`.
1 parent 151617b commit b31cd70

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

authorization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ This is identical to manually defining the following Gate definitions:
7878
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:
7979

8080
Gate::resource('posts', 'PostPolicy', [
81-
'posts.photo' => 'updatePhoto',
82-
'posts.image' => 'updateImage',
81+
'photo' => 'updatePhoto',
82+
'image' => 'updateImage',
8383
]);
8484

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

0 commit comments

Comments
 (0)