PHP code example of railken / permission

1. Go to this page and download the library: Download railken/permission 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/ */

    

railken / permission example snippets


use Railken\Permission\Traits\CanTrait;

class User
{
    use CanTrait;
}


$user->setPermissions([
    'me.*',
    'all.show',
]);

$user->can('me.anything');      // true
$user->can('foo');              // false
$user->can('all.wrong');        // false
$user->can('all.show');         // true
$user->can('all.show.wrong');   // false