1. Go to this page and download the library: Download wnikk/laravel-access-rules library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wnikk / laravel-access-rules example snippets
use Wnikk\LaravelAccessRules\AccessRules;
// Add new rule permission
AccessRules::newRule('articles.edit', 'Access to editing articles');
// Adding permissions to a user
$user->addPermission('articles.edit');
// According to the existing user from object
$user->inheritPermissionFrom(User::find(1));
// By identifier
$user->inheritPermissionFrom(User::class, 1);
// From the group
$user->inheritPermissionFrom('Group', 1);
$user->can('articles.edit');
$acr = new AccessRules;
$acr->setOwner('AnotherAnySystemUser', 'UserID-From-Any-System-FF01');
$check = $acr->hasPermission('articles.edit');
if (!$check) {abort(403);}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.