public function actionIndex() { $searchModel = new ArticleSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination->pageSize = 6; return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'articleCategories' => ArticleCategories::find()->all(), 'popularPosts' => Article::getPopularPosts()]); }
/** * Lists all Articles models. * @return mixed */ public function actionSearch() { $searchModel = new ArticleSearch(); $dataProvider = array(); $searchFlag = false; if ($searchModel->load(Yii::$app->request->get())) { $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $searchFlag = true; } return $this->render('search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'searchFlag' => $searchFlag]); }
/** * Lists all Article models. * @return mixed */ public function actionIndex() { $searchModel = new ArticleSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionIndex() { $searchModel = new ArticleSearch(); $dataProvider = $searchModel->search(['ArticleSearch' => ['is_active' => 1]]); return $this->render('index', ['$searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Manage Articles. * * @return mixed */ public function actionAdmin() { /** * How many articles we want to display per page. * @var integer */ $pageSize = 11; /** * Only admin+ roles can see everything. * Editors will be able to see only published articles and their own drafts @see: search(). * @var boolean */ $published = Yii::$app->user->can('admin') ? false : true; $searchModel = new ArticleSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $pageSize, $published); return $this->render('admin', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }