Example #1
0
<?php

use elgorm\rbacplus\models\Role;
$permissions = Role::getPermistions($model->name);
$first = '';
$rows = [];
foreach ($permissions as $permission) {
    if (empty($first)) {
        $first = $permission->name;
    } else {
        $rows[] = '<tr><td>' . $permission->name . '</td></tr>';
    }
}
?>
<div class="permistion-item-view">
    <table class="table table-striped table-bordered detail-view">
        <tbody>
            <tr><th><?php 
echo $model->attributeLabels()['name'];
?>
</th><td><?php 
echo $model->name;
?>
</td></tr>
            <tr><th><?php 
echo $model->attributeLabels()['description'];
?>
</th><td><?php 
echo $model->description;
?>
</td></tr>
Example #2
0
 /**
  * Finds the Role model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $name
  * @return Role the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($name)
 {
     if (($model = Role::find($name)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('rbac', 'The requested page does not exist.'));
     }
 }