/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Personal::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(['cellphone_no' => $this->cellphone_no, 'date_of_birth' => $this->date_of_birth, 'age' => $this->age, 'height' => $this->height, 'weight' => $this->weight, 'personal_id' => $this->personal_id]);
     $query->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'city_address', $this->city_address])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'place_of_birth', $this->place_of_birth])->andFilterWhere(['like', 'nationality', $this->nationality])->andFilterWhere(['like', 'religion', $this->religion]);
     return $dataProvider;
 }
 /**
  * Finds the Personal model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Personal the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Personal::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPersonal()
 {
     return $this->hasOne(Personal::className(), ['personal_id' => 'applicant_id']);
 }