Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Indikator::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(['TGL' => $this->TGL, 'NAVAT' => $this->NAVAT, 'NAV' => $this->NAV, 'TUMBUH' => $this->TUMBUH]);
     $query->andFilterWhere(['like', 'NAMA', $this->NAMA]);
     return $dataProvider;
 }
Esempio n. 2
0
 public function responseEdit($id)
 {
     $response = parent::responseEdit($id);
     $validation = $response['validation'];
     unset($response['validation']);
     if ($response['initial'] == true) {
         // Pas form baru kebuka
         $m = Indikator::find($id);
         $response['errors'] = [];
         $response['fields'] = $m->toArray();
         $response['output'] = view($this->formView, $response)->render();
     } elseif ($validation->passes()) {
         // Pas validasi berhasil
         $response['status'] = true;
         Indikator::addOrModify($response['data'], $id);
     } else {
         // Pas validasi gagal
         $response['fields'] = $response['data'];
         $response['output'] = view($this->formView, $response)->render();
     }
     return $response;
 }
Esempio n. 3
0
 /**
  * Finds the Indikator model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $TGL
  * @param string $NAMA
  * @return Indikator the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($TGL, $NAMA)
 {
     if (($model = Indikator::findOne(['TGL' => $TGL, 'NAMA' => $NAMA])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }