$query, ]); $dataProvider->sort ->attributes['customerName'] =[ 'asc' => ['customer.name' => SORT_ASC ], 'desc' => ['customer.name' => SORT_DESC ], ]; $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(Customer::tableName(), 'customer.id_customer_card = card.id_card'); $query->andFilterWhere([ 'card.status' => $this->status, 'card.type' => $this->type, ]); $query->andFilterWhere(['like', 'card.number', $this->number]); $query->andFilterWhere(['like', 'card.rfid_key', $this->rfid_key]); $query->andFilterWhere(['like', 'customer.name', $this->searchCustomerName]); return $dataProvider; } public function attributeLabels(){ $result = parent::attributeLabels(); $result +=[ 'searchCustomerName' => Yii::t('common/card','Customer') ]; return $result; } }