Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TeamRecord::find()->lang();
     $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]);
     $query->andFilterWhere(['like', 'lang', $this->lang])->andFilterWhere(['like', 'fullName', $this->fullName])->andFilterWhere(['like', 'post', $this->post])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'metaKeywords', $this->metaKeywords])->andFilterWhere(['like', 'metaDescription', $this->metaDescription])->andFilterWhere(['like', 'vkLink', $this->vkLink])->andFilterWhere(['like', 'facebookLink', $this->facebookLink])->andFilterWhere(['like', 'twitterLink', $this->twitterLink]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionList($lang = null)
 {
     $models = TeamRecord::find()->lang($lang)->orderBy(['RAND()' => ''])->all();
     return $this->render('list', ['models' => $models]);
 }