/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Factors::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, 'climate_land' => $this->climate_land, 'climate_accessibility' => $this->climate_accessibility, 'land_accessibility' => $this->land_accessibility, 'bobot_climate' => $this->bobot_climate, 'bobot_land' => $this->bobot_land, 'bobot_accessibility' => $this->bobot_accessibility, 'cr' => $this->cr, 'validation' => $this->validation, 'id_user' => $this->id_user, 'date' => $this->date]); return $dataProvider; }
/** * Finds the Factors model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Factors the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Factors::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }