frontend/models/search/TiketsSearch.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 = Tikets::find()->where(['user_id' => Yii::$app->user->identity->getId()]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort'=> [
                'defaultOrder' => ['tiket_count_new_admin'=>SORT_DESC],
                'attributes' => [
                    'tiket_id',
                    'tiket_created',
                    'tiket_email',
                    'tiket_theme',
                    'tiket_count_new_admin',
                ]
            ],
            'pagination' => [
                'pageSize' => 20,
                'route'=>'tikets/index',
            ],
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            'tiket_id' => $this->tiket_id,
            'tiket_created' => $this->tiket_created,
            'user_id' => $this->user_id,
        ]);
        if ($this->showNew > 0) {
            $query->andWhere('tiket_count_new_user >= 1');
        }
        $query->andFilterWhere(['like', 'tiket_theme', $this->tiket_theme]);
        return $dataProvider;
    }
public function search ( $ params ) { $ query = Tikets :: find ( ) -> where ( [ 'user_id' => Yii :: $ app -> user -> identity -> getId ( ) ] ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'sort' => [ 'defaultOrder' => [ 'tiket_count_new_admin' => SORT_DESC ] , 'attributes' => [ 'tiket_id' , 'tiket_created' , 'tiket_email' , 'tiket_theme' , 'tiket_count_new_admin' , ] ] , 'pagination' => [ 'pageSize' => 20 , 'route' => 'tikets/index' , ] , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'tiket_id' => $ this -> tiket_id , 'tiket_created' => $ this -> tiket_created , 'user_id' => $ this -> user_id , ] ) ; if ( $ this -> showNew > 0 ) { $ query -> andWhere ( 'tiket_count_new_user >= 1' ) ; } $ query -> andFilterWhere ( [ 'like' , 'tiket_theme' , $ this -> tiket_theme ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param array $params
Creates data provider instance with search query applied @param array $params
// add conditions that should always apply here // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); // grid filtering conditions //->andFilterWhere(['like', 'tiket_email', $this->tiket_email]) //->andFilterWhere(['like', 'tiket_name', $this->tiket_name]);