コード例 #1
0
ファイル: GodosSearch.php プロジェクト: cboy868/nana
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Goods::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'cover' => $this->cover, 'price' => $this->price, 'num' => $this->num, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'unit', $this->unit]);
     return $dataProvider;
 }