/**
  * Lists all Article models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ArticleSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $dataProvider->sort = ['defaultOrder' => ['published_at' => SORT_DESC]];
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
예제 #2
0
 /**
  * Lists all Article models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ArticleSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $dataProvider->sort = ['defaultOrder' => ['published_at' => SORT_DESC]];
     $dataProvider->query->andFilterWhere(['locale' => Yii::$app->language]);
     $models = Article::find()->andFilterWhere(['domain_id' => Yii::getAlias('@defaultDomainId'), 'locale' => 'uk-UA'])->all();
     $list = \yii\helpers\ArrayHelper::map($models, 'locale_group_id', 'title');
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'list' => $list]);
 }