示例#1
0
 protected function findModel($id)
 {
     if (($model = Me::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Требуемая страница не существует.');
     }
 }
示例#2
0
 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;
 }