public function search($params) { $query = Recommend::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'list_order' => $this->list_order]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'body', $this->body])->andFilterWhere(['like', 'profession', $this->profession])->andFilterWhere(['like', 'photo_image', $this->photo_image]); return $dataProvider; }
/** * Главная страница */ public function actionIndex() { $this->showSearchBlock = true; return $this->render('index', ['review_list' => Recommend::find()->select('*')->orderBy('list_order DESC')->asArray()->all(), 'orgList' => Organization::loadList('*', 'priority > 0', 'priority desc'), 'productList' => Product::loadList('*', 'priority > 0', 'priority desc'), 'specList' => Specialist::loadList()]); }
/** * Finds the Recommend model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Recommend the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Recommend::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }