/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = StatusPeserta::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { $query->where('1=0'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'status_peserta', $this->status_peserta]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getStatusPeserta() { return $this->hasOne(StatusPeserta::className(), ['id' => 'status_peserta_id']); }
/** * Finds the StatusPeserta model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StatusPeserta the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = StatusPeserta::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }