Exemple #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Peserta::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status_peserta_id' => $this->status_peserta_id]);
     $query->andFilterWhere(['like', 'nikkes', $this->nikkes])->andFilterWhere(['like', 'nik', $this->nik])->andFilterWhere(['like', 'nama_kk', $this->nama_kk])->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'band', $this->band]);
     return $dataProvider;
 }
 /**
  * Finds the Peserta model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Peserta the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Peserta::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionGetDataPeserta($nikkes)
 {
     $dataPeserta = Peserta::find()->where(['nikkes' => $nikkes])->one();
     echo Json::encode($dataPeserta);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getNikkes0()
 {
     return $this->hasOne(Peserta::className(), ['nikkes' => 'nikkes']);
 }
Exemple #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPesertas()
 {
     return $this->hasMany(Peserta::className(), ['status_peserta_id' => 'id']);
 }