PHP code example of potatopowered / role-auth

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

    

potatopowered / role-auth example snippets


$this->loadComponent('RoleAuth.RoleAuth');

$this->loadComponent('RoleAuth.RoleAuth', [
  'roles_table' => 'roles',
  'admin_role' => 'Admin',
  'default_role' => 'User'
]);

$this->RoleAuth->isAdmin($this->Auth->user('role_id'));

$this->RoleAuth->hasRole('YourRole', $this->Auth->user('role_id'));

$this->RoleAuth->setRoles($this->Auth->user());