Skip to content

Commit

Permalink
Updated the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
santigarcor committed Jun 24, 2016
1 parent aafca1c commit c010d15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ $editUser->description = 'edit existing users'; // optional
$editUser->save();

$admin->attachPermission($createPost);
// equivalent to $admin->perms()->sync(array($createPost->id));
// equivalent to $admin->perms()->sync([$createPost->id]);

$owner->attachPermissions(array($createPost, $editUser));
// equivalent to $owner->perms()->sync(array($createPost->id, $editUser->id));
$owner->attachPermissions([$createPost, $editUser]);
// equivalent to $owner->perms()->sync([$createPost->id, $editUser->id]);
```

## Checking for Roles & Permissions
Expand Down Expand Up @@ -116,7 +116,7 @@ It takes in three parameters (roles, permissions, options):
Either of the roles or permissions variable can be a comma separated string or array:

```php
$user->ability(array('admin', 'owner'), array('create-post', 'edit-user'));
$user->ability(['admin', 'owner'], ['create-post', 'edit-user']);

// or

Expand All @@ -129,10 +129,10 @@ In this case it will return true since the user is an `admin` and has the `creat
The third parameter is an options array:

```php
$options = array(
$options = [
'validate_all' => true | false (Default: false),
'return_type' => boolean | array | both (Default: boolean)
);
];
```

- `validate_all` is a boolean flag to set whether to check all the values for true, or to return true if at least one role or permission is matched.
Expand All @@ -141,14 +141,14 @@ $options = array(
Here is an example output:

```php
$options = array(
$options = [
'validate_all' => true,
'return_type' => 'both'
);
];

list($validate, $allValidations) = $user->ability(
array('admin', 'owner'),
array('create-post', 'edit-user'),
['admin', 'owner'],
['create-post', 'edit-user'],
$options
);

Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can also publish the configuration for this package to further customize tab

Just use `php artisan vendor:publish` and a `laratrust.php` file will be created in your app/config directory.

## Automatic setup
## Automatic setup (Recommended)
If you want to let laratrust to setup by itselft, just run the following command:

```bash
Expand Down

0 comments on commit c010d15

Please sign in to comment.