/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LlbActivity::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'age' => $this->age, 'createdate' => $this->createdate, 'enddate' => $this->enddate, 'ownerid' => $this->ownerid, 'status' => $this->status, 'views' => $this->views, 'formid' => $this->formid, 'starttime' => $this->starttime]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'guest', $this->guest])->andFilterWhere(['like', 'gender', $this->gender])->andFilterWhere(['like', 'job', $this->job])->andFilterWhere(['like', 'guest_intro', $this->guest_intro])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'address_intro', $this->address_intro])->andFilterWhere(['like', 'endintro', $this->endintro])->andFilterWhere(['like', 'attachment', $this->attachment]); return $dataProvider; }
/** * Finds the LlbActivity model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return LlbActivity the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = LlbActivity::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }