frontend/models/search/UserPaymentsSearch.php
/**
     * Creates data provider instance with search query applied
     * @return ActiveDataProvider
     */
Creates data provider instance with search query applied
@return ActiveDataProvider
Creates data provider instance with search query applied @return ActiveDataProvider
public function search()
    {
        $query = self::find()->where([
            'user_id'    => Yii::$app->user->identity->getId(),
            'pay_status' => UserPayments::STATUS_PAID,
        ]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort'=> [
                'defaultOrder' => ['pay_date'=>SORT_DESC],
                'attributes' => [
                    'pay_date',
                ]
            ],
            'pagination' => [
                'pageSize' => 5,
            ],
        ]);
        if (!$this->validate()) {
            return $dataProvider;
        }
        return $dataProvider;
    }
public function search ( ) { $ query = self :: find ( ) -> where ( [ 'user_id' => Yii :: $ app -> user -> identity -> getId ( ) , 'pay_status' => UserPayments :: STATUS_PAID , ] ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'sort' => [ 'defaultOrder' => [ 'pay_date' => SORT_DESC ] , 'attributes' => [ 'pay_date' , ] ] , 'pagination' => [ 'pageSize' => 5 , ] , ] ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } return $ dataProvider ; }
Creates data provider instance with search query applied
 @return ActiveDataProvider
Creates data provider instance with search query applied @return ActiveDataProvider
// 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');