Skip to content

Commit bf7bdc0

Browse files
committed
edit readme
1 parent 8b57afd commit bf7bdc0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All notable changes to `laravel-permission` will be documented in this file
44

5+
## 2.6.0 - 2017-09-10
6+
- add `permission` scope
7+
58
## 2.5.4 - 2017-09-07
69
- register the blade directives in the register method of the service provider
710

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,21 @@ $permissions = $user->getAllPermissions();
225225
$roles = $user->getRoleNames(); // Returns a collection
226226
```
227227

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:
229229

230230
```php
231231
$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.
232235

236+
The same trait also adds a scope to only get users that have a certain permission.
237+
238+
```php
233239
$users = User::permission('edit articles')->get(); // Returns only users with the permission 'edit articles' (inherited or directly)
234240
```
235241

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.
237243

238244
### Using "direct" permissions (see below to use both roles and permissions)
239245

0 commit comments

Comments
 (0)