/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Pemohon::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'nomor_identitas' => $this->nomor_identitas, 'tanggal_lahir' => $this->tanggal_lahir, 'tanggal_add' => $this->tanggal_add, 'tanggal_update' => $this->tanggal_update]); $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'jenis_kelamin', $this->jenis_kelamin])->andFilterWhere(['like', 'tempat_lahir', $this->tempat_lahir])->andFilterWhere(['like', 'agama', $this->agama])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'pekerjaan', $this->pekerjaan])->andFilterWhere(['like', 'tempat', $this->tempat])->andFilterWhere(['like', 'nomor_telpon', $this->nomor_telpon])->andFilterWhere(['like', 'nama_orangtua', $this->nama_orangtua])->andFilterWhere(['like', 'agama_orangtua', $this->agama_orangtua])->andFilterWhere(['like', 'pekerjaan_orangtua', $this->pekerjaan_orangtua])->andFilterWhere(['like', 'nomor_telpon_orangtua', $this->nomor_telpon_orangtua])->andFilterWhere(['like', 'nama_saudara', $this->nama_saudara])->andFilterWhere(['like', 'agama_saudara', $this->agama_saudara])->andFilterWhere(['like', 'pekerjaan_saudara', $this->pekerjaan_saudara])->andFilterWhere(['like', 'nomor_telpon_saudara', $this->nomor_telpon_saudara])->andFilterWhere(['like', 'hubungan_saudara', $this->hubungan_saudara])->andFilterWhere(['like', 'keterangan', $this->keterangan]); return $dataProvider; }
/** * Finds the Pemohon model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Pemohon the loaded model * @throws HttpException if the model cannot be found */ protected function findModel($id) { if (($model = Pemohon::findOne($id)) !== null) { return $model; } else { throw new HttpException(404, 'The requested page does not exist.'); } }