PHP code example of koterle / roleable

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

    

koterle / roleable example snippets


php artisan vendor:publish

php artisan migrate

use CanTrait;

if (Auth::user()->is('administrator', 'Company', 1)) { ... }
if (Auth::user()->can('manage_users', 'Company', 1)) { ... }
if (Auth::user()->cannot('delete_posts', 'Blog', 1)) { ... }

Auth::user()->attachRole('administrator', 'Company', 1);
Auth::user()->detachRole('administrator', 'Company', 1);