Commit 8a575400 authored by Shakarim Sapa's avatar Shakarim Sapa

- Fix

parent bf31f0ef
......@@ -34,8 +34,6 @@ class CourseController extends FrontendController {
$searchModel = new CoursesSearch();
$search = \Yii::$app->request->queryParams;
var_dump($search); die;
$dataProvider = $searchModel->search($search);
return $this->render(
......
......@@ -42,7 +42,7 @@ class CoursesSearch extends AnalyticsSchoolCourse {
*/
public function search($params)
{
if ($params){
if (count($params)>0){
$params = array_filter($params);
$query = AnalyticsSchoolCourse::findByCondition($params);
}
......@@ -57,14 +57,12 @@ class CoursesSearch extends AnalyticsSchoolCourse {
]);
$query->andFilterWhere(['like', 'description', $this->description])
->andFilterWhere(['like', 'name', $this->title])
->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'image', $this->image]);
$query->orderBy(['id' => SORT_DESC]);
$dataProvider = new ActiveDataProvider([
return new ActiveDataProvider([
'query' => $query,
]);
return $dataProvider;
}
}
\ No newline at end of file
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