예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Booktour::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['depdate' => 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;
     }
     if (isset($_GET['BooktourSearch']['status']) && $_GET['BooktourSearch']['status'] == 'Complete') {
         $this->status = 1;
     } else {
         $this->status = 0;
     }
     $query->andFilterWhere(['id' => $this->id, 'id_tour' => $this->id_tour, 'nadults' => $this->nadults, 'child' => $this->child, 'depdate' => $this->depdate, 'visa' => $this->visa, 'usebefore' => $this->usebefore, 'reciveinfo' => $this->reciveinfo]);
     $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'nation', $this->nation])->andFilterWhere(['like', 'listname', $this->listname])->andFilterWhere(['like', 'childinfo', $this->childinfo])->andFilterWhere(['like', 'idea', $this->idea])->andFilterWhere(['like', 'paymethod', $this->paymethod])->andFilterWhere(['like', 'knwthrough', $this->knwthrough])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
 /**
  * Finds the Booktour model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Booktour the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Booktour::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
 public function getBooktours()
 {
     return $this->hasMany(Booktour::className(), ['id_tour' => 'id']);
 }