コード例 #1
0
 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;
 }
コード例 #2
0
 /**
  * Главная страница
  */
 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()]);
 }