Commit d01bedc6 authored by Shakarim Sapa's avatar Shakarim Sapa

- В модель SearchCoContent добавлен метод поиска по конкретному типу

parent 4173941c
......@@ -67,4 +67,32 @@ class SearchCoContent extends CoContent
return $dataProvider;
}
public function searchByType($id, $params){
$query = CoContent::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,
'category_id' => $id,
'active' => $this->active,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'url', $this->url]);
return $dataProvider;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment