Skip to content

Commit f26a20e

Browse files
authored
Merge pull request #4710 from sandofvega/5.5
[5.5] Add full Namespace to Resource Gates in Authorization
2 parents e48166c + 6fdd7b6 commit f26a20e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

authorization.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ Gates may also be defined using a `Class@method` style callback string, like con
5959
{
6060
$this->registerPolicies();
6161

62-
Gate::define('update-post', 'PostPolicy@update');
62+
Gate::define('update-post', 'App\Policies\PostPolicy@update');
6363
}
6464

6565
#### Resource Gates
6666

6767
You may also define multiple Gate abilities at once using the `resource` method:
6868

69-
Gate::resource('posts', 'PostPolicy');
69+
Gate::resource('posts', 'App\Policies\PostPolicy');
7070

7171
This is identical to manually defining the following Gate definitions:
7272

73-
Gate::define('posts.view', 'PostPolicy@view');
74-
Gate::define('posts.create', 'PostPolicy@create');
75-
Gate::define('posts.update', 'PostPolicy@update');
76-
Gate::define('posts.delete', 'PostPolicy@delete');
73+
Gate::define('posts.view', 'App\Policies\PostPolicy@view');
74+
Gate::define('posts.create', 'App\Policies\PostPolicy@create');
75+
Gate::define('posts.update', 'App\Policies\PostPolicy@update');
76+
Gate::define('posts.delete', 'App\Policies\PostPolicy@delete');
7777

7878
By default, the `view`, `create`, `update`, and `delete` abilities will be defined. You may override or add to the default abilities by passing an array as a third argument to the `resource` method. The keys of the array define the names of the abilities while the values define the method names. For example, the following code will create two new Gate definitions - `posts.image` and `posts.photo`:
7979

0 commit comments

Comments
 (0)