/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ImagesCommon::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'is_active' => $this->is_active, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'path', $this->path])->andFilterWhere(['like', 'hash', $this->hash])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'exp', $this->exp]); return $dataProvider; }
/** * Finds the ImagesCommon model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ImagesCommon the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ImagesCommon::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }