Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TourCompany::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, 'effective_date' => $this->effective_date, 'expire_date' => $this->expire_date, 'mobile_no' => $this->mobile_no, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'license_no', $this->license_no])->andFilterWhere(['like', 'trader_name', $this->trader_name])->andFilterWhere(['like', 'trader_name_en', $this->trader_name_en])->andFilterWhere(['like', 'category', $this->category])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'province', $this->province])->andFilterWhere(['like', 'amphur', $this->amphur])->andFilterWhere(['like', 'district', $this->district])->andFilterWhere(['like', 'zipcode', $this->zipcode])->andFilterWhere(['like', 'telephone', $this->telephone])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Finds the TourCompany model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TourCompany the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TourCompany::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['trader_name', 'address', 'mobile_no', 'email'], 'required'], [['user_id', 'province', 'amphur', 'zipcode'], 'integer'], [['license_no'], 'string', 'max' => 8], [['effective_date', 'expire_date'], 'safe'], [['trader_name', 'trader_name_en', 'trader_category', 'address', 'mobile_no', 'telephone', 'email'], 'string', 'max' => 255], ['license_no', 'exist', 'targetClass' => TourCompany::className(), 'message' => 'ไม่พบเลขที่ใบอนุญาตในระบบ หรือ อาจยังไม่ได้ลงทะเบียนในระบบ จากกรมการท่องเที่ยว.']];
 }
Ejemplo n.º 4
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['license_no', 'trader_name', 'trader_name_en', 'effective_date', 'expire_date'], 'required'], [['effective_date', 'expire_date'], 'safe'], [['mobile_no', 'created_at', 'updated_at', 'created_by', 'updated_by', 'status'], 'integer'], [['license_no'], 'string', 'max' => 8], [['trader_name', 'trader_name_en'], 'string', 'max' => 128], [['category', 'address', 'telephone', 'email'], 'string', 'max' => 255], [['province', 'amphur', 'district', 'zipcode'], 'string', 'max' => 5], ['license_no', 'exist', 'targetClass' => TourCompany::className()]];
 }
 public function actionGetCompanyInfo($license_no)
 {
     // find the zip code from the locations table
     $location = TourCompany::findOne($license_no);
     echo Json::encode($location);
 }