/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Fakta::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(['id' => $this->id, 'tahun' => $this->tahun, 'id_user' => \Yii::$app->user->identity->id, 'id_bulan' => $this->id_bulan, 'id_variabel' => $this->id_variabel, 'id_kategori' => $this->id_kategori, 'id_item_kategori' => $this->id_item_kategori, 'id_sumber_data' => $this->id_sumber_data, 'nilai' => $this->nilai]); $query->andFilterWhere(['like', 'id_wilayah', $this->id_wilayah])->andFilterWhere(['like', 'kode_unik', $this->kode_unik]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getFaktas() { return $this->hasMany(Fakta::className(), ['id_variabel' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getFaktas() { return $this->hasMany(Fakta::className(), ['id_sumber_data' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getFaktas() { return $this->hasMany(Fakta::className(), ['id_wilayah' => 'id']); }
/** * Finds the Fakta model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Fakta the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Fakta::findOne(['id' => $id, 'id_user' => \Yii::$app->user->identity->id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getFaktas() { return $this->hasMany(Fakta::className(), ['id_kategori' => 'id']); }