/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Exchangeprogram::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(['exchange_program_id' => $this->exchange_program_id, 'university_id' => $this->university_id, 'specialty_id' => $this->specialty_id, 'language_id' => $this->language_id, 'date' => $this->date]); $query->andFilterWhere(['like', 'university_name', $this->university_name])->andFilterWhere(['like', 'language_name', $this->language_name])->andFilterWhere(['like', 'country', $this->country])->andFilterWhere(['like', 'specialty_name', $this->specialty_name])->andFilterWhere(['like', 'period', $this->period])->andFilterWhere(['like', 'conditions', $this->conditions])->andFilterWhere(['like', 'images', $this->images]); return $dataProvider; }
/** * Finds the Exchangeprogram model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Exchangeprogram the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Exchangeprogram::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }