/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = BorderCheckpoint::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(['id' => $this->id, 'border_province' => $this->border_province]); $query->andFilterWhere(['like', 'border_thai', $this->border_thai])->andFilterWhere(['like', 'border_other', $this->border_other])->andFilterWhere(['like', 'border_land', $this->border_land]); return $dataProvider; }
protected function getBorder($id) { $datas = BorderCheckpoint::find()->where(['border_province' => $id])->all(); return $this->MapData($datas, 'id', 'border_thai'); }