Exemplo n.º 1
0
 public function search($params)
 {
     $query = CustomerDetailModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_customer' => $this->id_customer, 'id_distric' => $this->id_distric, 'id_kab' => $this->id_kab, 'id_kec' => $this->id_kec, 'id_kel' => $this->id_kel, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'addr1', $this->addr1])->andFilterWhere(['like', 'addr2', $this->addr2])->andFilterWhere(['like', 'latitude', $this->latitude])->andFilterWhere(['like', 'longtitude', $this->longtitude])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCustomerDetail()
 {
     return $this->hasOne(CustomerDetail::className(), ['id_customer' => 'id_customer']);
 }
 /**
  * Finds the CustomerDetail model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  integer               $id
  * @return CustomerDetail        the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CustomerDetail::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }