File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
All notable changes to ` laravel-permission ` will be documented in this file
4
4
5
+ ## 2.6.0 - 2017-09-10
6
+ - add ` permission ` scope
7
+
5
8
## 2.5.4 - 2017-09-07
6
9
- register the blade directives in the register method of the service provider
7
10
Original file line number Diff line number Diff line change @@ -225,15 +225,21 @@ $permissions = $user->getAllPermissions();
225
225
$roles = $user->getRoleNames(); // Returns a collection
226
226
```
227
227
228
- The ` HasRoles ` trait also adds a scope to your models to scope the query to certain roles or permissions:
228
+ The ` HasRoles ` trait also add a ` role ` scopes to your models to scope the query to certain roles or permissions:
229
229
230
230
``` php
231
231
$users = User::role('writer')->get(); // Returns only users with the role 'writer'
232
+ ```
233
+
234
+ The ` role ` scope can accept a string, a ` \Spatie\Permission\Models\Role ` object or an ` \Illuminate\Support\Collection ` object.
232
235
236
+ The same trait also adds a scope to only get users that have a certain permission.
237
+
238
+ ``` php
233
239
$users = User::permission('edit articles')->get(); // Returns only users with the permission 'edit articles' (inherited or directly)
234
240
```
235
241
236
- The scope can accept a string, a ` \Spatie\Permission\Models\Role ` object or an ` \Illuminate\Support\Collection ` object.
242
+ The scope can accept a string, a ` \Spatie\Permission\Models\Permission ` object or an ` \Illuminate\Support\Collection ` object.
237
243
238
244
### Using "direct" permissions (see below to use both roles and permissions)
239
245
You can’t perform that action at this time.
0 commit comments