/** * Lists all Users models. * @return mixed */ public function actionIndex() { $searchModel = new UsersSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $this->layout = 'left-column'; return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Users models. * @return mixed */ public function actionIndex() { $searchModel = new UsersSearch(); //Yii::$app->request->queryParams 获取get请求的参数 个人认为 等同于 Yii::$app->request->get() $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Users models. * @return mixed */ public function actionIndex() { if (\Yii::$app->user->isGuest || !\Yii::$app->user->identity->isAdmin()) { throw new ForbiddenHttpException('You are not allowed to access this page.'); } $searchModel = new UsersSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Users models. * @return mixed */ public function actionList() { $searchModel = new UsersSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('user-list', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }