public function search($params) { $query = Accounts::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'db_id' => $this->db_id]); // $query->andFilterWhere(['like', 'title', $this->title]) // ->andFilterWhere(['like', 'text', $this->text]); return $dataProvider; }
public function actionView($id) { $searchModel = new AccountsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('view', ['model' => $id == 0 ? Accounts::find()->all() : Accounts::findAll(['db_id' => $id]), 'base' => $id == 0 ? new Bases(['server' => 'Спам по всем аккам']) : Bases::findOne(['id' => $id]), 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }