Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Items::find()->where('id != :id', ['id' => 1]);
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'menutypeid' => $this->menutypeid, 'parentid' => $this->parentid, 'state' => $this->state]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'link', $this->link])->andFilterWhere(['like', 'params', $this->params])->andFilterWhere(['like', 'linkOptions', $this->linkOptions])->andFilterWhere(['like', 'access', $this->access])->andFilterWhere(['like', 'language', $this->language]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMenuitems()
 {
     return Items::find()->asArray()->all();
 }