这是控制器操作列表,如果用户角色不是超级用户,则应在用户表中显示用户
public function actionList()
{
$dataProvider = new ActiveDataProvider([
'query'=>User::find()->where(['not', 'is_super']),
'pagination' => [
'pageSize' => 20,
],
]);
return $this->render('list', ['dataProvider'=>$dataProvider]);
}
可能是什么问题
答案 0 :(得分:1)
将您的查询更改为
'query' => User::find()->where(['<>','is_super',1]),
或者,
<?php
$super = 1;
$dataProvider = new ActiveDataProvider([
'query' => User::find()->where(['<>','is_super',$super]),
'pagination' => [
'pageSize' => 20,
],
]);
?>
答案 1 :(得分:1)
尝试:
'query' => User::find()->where('is_super<>:is_super',[':is_super' => 1]),