public function actionCourselist($catid = null) { if (!empty($catid)) { //$model = Course::find()->where('cat_id'=> $catid)->all(); $searchModel = new CourseSearch(); $searchModel->category_id = $catid; $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination->pageSize = 0; } else { $searchModel = new CourseSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination->pageSize = 0; } return $this->render('courselist', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Course models. * @return mixed */ public function actionIndex() { $searchModel = new CourseSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }