/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = app::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, 'stars' => $this->stars, 'downloadcount' => $this->downloadcount, 'commentscount' => $this->commentscount, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'version', $this->version])->andFilterWhere(['like', 'profile', $this->profile])->andFilterWhere(['like', 'android_url', $this->android_url])->andFilterWhere(['like', 'ios_url', $this->ios_url])->andFilterWhere(['like', 'introduction', $this->introduction])->andFilterWhere(['like', 'size', $this->size])->andFilterWhere(['like', 'icon', $this->icon])->andFilterWhere(['like', 'updated_log', $this->updated_log])->andFilterWhere(['like', 'kind', $this->kind]); return $dataProvider; }
public function actionTest() { echo "test"; $dataProvider = new ActiveDataProvider(['query' => app::find()]); $pagination = $dataProvider->getPagination(); $count = $pagination->pageCount; $count1 = 0; while ($categories = $dataProvider->models) { foreach ($categories as $category) { echo $category['id']; } $count1++; if ($count1 > $count) { break; } } }
public function actionViewmsg($id) { $model = $this->findModel($id); $dataProvider = new ActiveDataProvider(['query' => app::find()->join('INNER JOIN', 'msgtoapp', 'msgtoapp.appid = app.id && msgtoapp.msgid = :msgid', [':msgid' => $model->id])]); $searchModel = new appSearch(); return $this->render('/admin/app', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }