/**
  * Displays a single Booktour model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     $visaRelation = Visa::find()->where(['fullname' => $model->fullname])->andWhere(['email' => $model->email])->andWhere(['regdate' => $model->depdate]);
     $provider = new \yii\data\ActiveDataProvider(['query' => $visaRelation, 'pagination' => ['pageSize' => 20]]);
     return $this->render('view', ['model' => $model, 'provider' => $provider]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Visa::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['regdate' => 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->andFilterWhere(['id' => $this->id, 'numapply' => $this->numapply, 'usebefore' => $this->usebefore, 'receiveinfo' => $this->receiveinfo, 'regdate' => $this->regdate, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'nation', $this->nation])->andFilterWhere(['like', 'visatype', $this->visatype])->andFilterWhere(['like', 'processtime', $this->processtime])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'knwthrough', $this->knwthrough])->andFilterWhere(['like', 'paymethod', $this->paymethod]);
     return $dataProvider;
 }
 /**
  * Finds the Visa model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Visa the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Visa::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * relation to visa table
  *
  */
 public function getVisa()
 {
     return $this->hasOne(Visa::className(), ['id' => 'id_visa']);
 }