admin/models/MenuItemSearch.php
/**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
Creates data provider instance with search query applied
@param array $params


Creates data provider instance with search query applied @param array $params
public function search($params)
    {
        $query = MenuItem::find();
        $query->joinWith('translation');
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort'=> [
                'defaultOrder' => [
                    'position' => SORT_ASC,
                ],
            ],
            'pagination' => false,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andWhere(['parent_id' => $this->parent_id ? $this->parent_id : null]);
        $query->andFilterWhere([
            'id' => $this->id,
            'menu_id' => $this->menu_id,
            'position' => $this->position,
            'enabled' => $this->enabled,
        ]);
        $query->andFilterWhere(['like', 'icon', $this->icon])
            ->andFilterWhere(['like', 'url', $this->url])
            ->andFilterWhere(['like', 'link', $this->link])
            ->andFilterWhere(['like', 'label', $this->label]);
        return $dataProvider;
    }
public function search ( $ params ) { $ query = MenuItem :: find ( ) ; $ query -> joinWith ( 'translation' ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'sort' => [ 'defaultOrder' => [ 'position' => SORT_ASC , ] , ] , 'pagination' => false , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andWhere ( [ 'parent_id' => $ this -> parent_id ? $ this -> parent_id : null ] ) ; $ query -> andFilterWhere ( [ 'id' => $ this -> id , 'menu_id' => $ this -> menu_id , 'position' => $ this -> position , 'enabled' => $ this -> enabled , ] ) ; $ query -> andFilterWhere ( [ 'like' , 'icon' , $ this -> icon ] ) -> andFilterWhere ( [ 'like' , 'url' , $ this -> url ] ) -> andFilterWhere ( [ 'like' , 'link' , $ this -> link ] ) -> andFilterWhere ( [ 'like' , 'label' , $ this -> label ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param array $params
Creates data provider instance with search query applied @param array $params
// uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); // grid filtering conditions