protected function findModel($id) { if (($model = Me::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('Требуемая страница не существует.'); } }
public function search($params) { $query = Me::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'name' => $this->name, 'about' => $this->about]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'about', $this->about]); return $dataProvider; }