* @copyright (c), Thread */ class Articles { public $limit = 20; /** * @return ActiveDataProvider */ public function search() { $q = Article::find(); $dataProvider = new ActiveDataProvider([ 'query' => $q, 'pagination' => [ 'class' => Pagination::class, 'pageSize' => $this->limit ], 'sort' => [ 'defaultOrder' => [ 'id' => SORT_DESC ] ] ]); return $dataProvider; } }