Hello Friends,
i have multiple role in my application i want to add filter by role in user grid.
i have used default yii2 advance template user table and rbac table.
in my controller
public function actionIndex()
{
$searchModel = new UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
in my view file
<?php echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'options' => [
'class' => 'grid-view table-responsive'
],
'columns' => [
'id',
'username',
'email:email',
[
'class' => EnumColumn::className(),
'attribute' => 'status',
'enum' => User::statuses(),
'filter' => User::statuses()
],
'created_at:datetime',
'logged_at:datetime',
// 'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
how can i add filter by role in user grid.
i have five table to accomplish this
user
auth_assignment
auth_item
auth_item_child
auth_rule
any one have developed this type of grid…?? please help