Skip to content

Commit

Permalink
updates to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcefli committed Mar 8, 2021
1 parent 1f72dce commit 007a44e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ Route::get('permissions', function () {
OwnedPermission::billing()->edit();
//returns 'billing.[owned].edit'
});

//or, get all 'resources' now available to you:
Route::get('permissions', function () {
return collect([OwnedPermission::all(), TeamPermission::all()])->toArray();
});
```
**or**

Expand Down Expand Up @@ -135,9 +140,13 @@ Route::get('permissions', function () {
OwnedSettingPermission::smtp()->edit();
//returns 'smtp.[owned_setting].edit'
});
```
or

//or, get all 'settings' now available to you:
Route::get('permissions', function () {
return collect([OwnedSettingPermission::all(), TeamSettingPermission::all()])->toArray();
});

```
This example might be the permission used when you want to know if:

_The current user can edit the smtp settings THEIR TEAM OWNS_
Expand Down Expand Up @@ -210,8 +219,8 @@ ownedPermission();
---

### ONLY and EXCEPT methods
Often times, when you're defining roles, and which permissions are associated with them, you'll need to tell your app which permissions should be included/excluded from each set of 'resources' or 'settings' that you've defined in the config file.
For this, you can use the `only()` method or the `except()` method. These methods accept a comma-seperated list of 'abilities' or an array.
As briefly shown above, when you're defining roles and which permissions are associated with them, you'll need to tell your app which permissions should be included/excluded from each set of 'resources' or 'settings' that you've defined in the config file.
For this, you can use the `only()` method or the `except()` method. These methods accept a list of abilities as a comma-seperated string or an array.

For Example, if using the same configs as mentioned above:
```php
Expand Down

0 comments on commit 007a44e

Please sign in to comment.