$query, ]); $dataProvider->sort ->attributes['customerCardNumber'] =[ 'asc' => ['card.number' => SORT_ASC ], 'desc' => ['card.number' => SORT_DESC ], ]; $dataProvider->sort->defaultOrder = [ 'name' => SORT_ASC, ]; // $dataProvider->setSort( // [ // 'attributes' => [ // 'id', // 'fullName' => [ // 'asc' => ['first_name' => SORT_ASC, 'last_name' => SORT_ASC], // 'desc' => ['first_name' => SORT_DESC, 'last_name' => SORT_DESC], // 'label' => 'Full Name', // 'default' => SORT_ASC // ], // 'country_id' // ] // ]); $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->leftJoin(Card::tableName(), " customer.id_customer_card = card.id_card" ); // $query->andFilterWhere([ // 'id_customer' => $this->id_customer, // 'id_customer_card' => $this->id_customer_card, // 'id_user' => $this->id_user, // 'id_partner_card' => $this->id_partner_card, // 'id_proposer' => $this->id_proposer, // 'sex' => $this->sex, // 'date_stundent_card_expire' => $this->date_stundent_card_expire, // 'birthdate' => $this->birthdate, // 'created_at' => $this->created_at, // 'updated_at' => $this->updated_at, // ]); $query->andFilterWhere(['like', 'customer.name', $this->name]) ->andFilterWhere(['like', 'customer.email', $this->email]) ->andFilterWhere(['like', 'card.number', $this->cardNumber]) ->andFilterWhere(['like', 'address', $this->address]); return $dataProvider; } public function attributeLabels( ) { $labels = parent::attributeLabels(); return $labels; } }