/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Mtmembers::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $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->andFilterWhere(['member_id' => $this->member_id, 'member_group_id' => $this->member_group_id, 'member_identity_type_id' => $this->member_identity_type_id, 'member_city_id' => $this->member_city_id, 'member_created' => $this->member_created, 'member_updated' => $this->member_updated, 'member_register_date' => $this->member_register_date]); $query->andFilterWhere(['like', 'member_identity_number', $this->member_identity_number])->andFilterWhere(['like', 'member_code', $this->member_code])->andFilterWhere(['like', 'member_sex', $this->member_sex])->andFilterWhere(['like', 'member_address', $this->member_address])->andFilterWhere(['like', 'member_address_zipcode', $this->member_address_zipcode])->andFilterWhere(['like', 'member_contact_phone', $this->member_contact_phone])->andFilterWhere(['like', 'member_contact_mobile', $this->member_contact_mobile])->andFilterWhere(['like', 'member_contact_email', $this->member_contact_email])->andFilterWhere(['like', 'member_picture', $this->member_picture])->andFilterWhere(['like', 'member_remark', $this->member_remark])->andFilterWhere(['like', 'member_status', $this->member_status])->andFilterWhere(['like', 'member_card_status', $this->member_card_status]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getMtmembers() { return $this->hasMany(Mtmembers::className(), ['member_city_id' => 'city_id']); }