Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Alumni::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(['alumni_id' => $this->alumni_id, 'e_jantina' => $this->e_jantina]);
     $query->andFilterWhere(['like', 'e_nama', $this->e_nama])->andFilterWhere(['like', 'e_kp', $this->e_kp])->andFilterWhere(['like', 'e_alamat', $this->e_alamat])->andFilterWhere(['like', 'e_poskod', $this->e_poskod])->andFilterWhere(['like', 'e_alamat_tetap', $this->e_alamat_tetap])->andFilterWhere(['like', 'e_poskod_tetap', $this->e_poskod_tetap])->andFilterWhere(['like', 'e_tel_rumah', $this->e_tel_rumah])->andFilterWhere(['like', 'e_tel_hp', $this->e_tel_hp])->andFilterWhere(['like', 'e_emel1', $this->e_emel1])->andFilterWhere(['like', 'e_emel2', $this->e_emel2])->andFilterWhere(['like', 'e_program', $this->e_program])->andFilterWhere(['like', 'e_fakulti', $this->e_fakulti])->andFilterWhere(['like', 'e_tahun_tamat', $this->e_tahun_tamat]);
     return $dataProvider;
 }
 /**
  * Finds the Alumni model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Alumni the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Alumni::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }