PHP code example of solarios / permission

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

    

solarios / permission example snippets


'providers' => [
    // ...
    Solarios\Permission\PermissionServiceProvider::class,
];

$user->givePermissionTo('manage users');

$user->hasPermissionTo('manage users');
// Returns: true

$user->giveRole('admin');
// The admin role has the 'manage users' permission.

$role->hasPermissionTo('manage users');
// Returns: true

$user->revokePermissionTo('manage users');

$user->giveRole('editor');

$user->hasRole('editor');
// Returns: true

$user->revokeRole('editor');