/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Providers::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_prov' => $this->id_prov, 'id_con' => $this->id_con, 'score_prov' => $this->score_prov, 'datetime_added_prov' => $this->datetime_added_prov]); $query->andFilterWhere(['like', 'email_prov', $this->email_prov])->andFilterWhere(['like', 'name_prov', $this->name_prov])->andFilterWhere(['like', 'phone_prov', $this->phone_prov])->andFilterWhere(['like', 'address_prov', $this->address_prov]); return $dataProvider; }
/** * Finds the Providers model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Providers the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Providers::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }