Exemple #1
0
 /**
  * Lists all UserAuthorize models.
  * @return mixed
  */
 public function actionIndex($id)
 {
     $query = UserAuthorize::find();
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => Yii::$app->params['pagination']]);
     $models = $query->offset($pages->offset)->limit($pages->limit)->where("user_id = {$id}")->all();
     return $this->render('index', ['models' => $models, 'pages' => $pages, 'id' => $id]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserAuthorize::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'role_id' => $this->role_id, 'state' => $this->state, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     return $dataProvider;
 }