您好,登錄后才能下訂單哦!
controller
public function actionIndex(){ $myUser = new MyUser(); $myuserQuery = $myUser::find()->select(['fuid','fusername','femail','fstatus','fname'])->join(' LEFT JOIN','wanguan_roles','wanguan_admin.frule = wanguan_roles.fid'); $listDataProvider = new ActiveDataProvider([ 'query' => $myuserQuery, 'pagination' => [ 'pageSize' => 50, ], ]); return $this->render('list', ['listDataProvider' => $listDataProvider]); }
view
<?php echo GridView::widget([ 'summary'=>false, 'dataProvider' => $listDataProvider, 'pager'=>[ 'firstPageLabel'=>'首頁', 'lastPageLabel'=>'尾頁', 'nextPageLabel'=>'下一頁', 'prevPageLabel'=>'上一頁', 'maxButtonCount'=>6, ], 'columns'=>[ [ 'attribute'=>'fusername', 'label'=>'用戶名', ], [ 'attribute'=>'femail', 'label'=>'郵箱' ], [ 'attribute'=>'fstatus', 'label'=>'狀態', 'format'=>'raw', 'value'=>function($model){ return $model['fstatus']==1?Html::tag('span','有效',['class'=>'label label-success','id'=>$model['fuid'],'data'=>['id'=>$model['fuid']]]):Html::tag('span','無效',['class'=>'label label-default','id'=>$model['fuid'],'data'=>['id'=>$model['fuid']]]); } ], [ 'attribute'=>'fname', 'label'=>'角色', 'value'=>function($model){ return isset($model->fname)?$model->fname:''; } ] ] ]);?>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。