/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Settings::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['sort' => $this->sort]); $query->andFilterWhere(['like', 'sname', $this->sname])->andFilterWhere(['like', 'svalue', $this->svalue])->andFilterWhere(['like', 'svalues', $this->svalues])->andFilterWhere(['like', 'sintro', $this->sintro])->andFilterWhere(['like', 'stype', $this->stype])->andFilterWhere(['like', 'smodule', $this->smodule]); return $dataProvider; }
/** * Finds the Settings model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Settings the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Settings::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }