From c010d15acd9c6118df88b8d2310b13b328dc65a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Garc=C3=ADa?= Date: Thu, 23 Jun 2016 21:26:40 -0500 Subject: [PATCH] Updated the docs --- docs/concepts.md | 20 ++++++++++---------- docs/config.md | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/concepts.md b/docs/concepts.md index a409ac3e..7d6f4f88 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -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 @@ -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 @@ -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. @@ -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 ); diff --git a/docs/config.md b/docs/config.md index 8d06a1b1..7669095f 100644 --- a/docs/config.md +++ b/docs/config.md @@ -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