/** * 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'); }
public function getEndBorderPoint() { return @$this->hasOne(BorderCheckpoint::className(), ['id' => 'out_border_point']); }
public function getBorderPoint() { return @$this->hasOne(BorderCheckpoint::className(), ['id' => 'br_code']); }
/** * Finds the BorderCheckpoint model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return BorderCheckpoint the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = BorderCheckpoint::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }