1. Go to this page and download the library: Download gozoro/yii2-rbac-console 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/ */
gozoro / yii2-rbac-console example snippets
namespace app\commands;
class RbacController extends \gozoro\yii2\rbac\console\RbacController;
{
public function findIdentityByUsername($username)
{
//TODO:: Return an instance of the class with interface \yii\web\Identity
// example:
//return UserIdentity::find()->where(['username'=>$username])->one();
}
public function findIdentityById($userId)
{
//TODO:: Return an instance of the class with interface \yii\web\Identity
// example:
//return UserIdentity::find()->where(['id'=>$userId])->one();
}
}