public function actionCities() { $query = Top::find(); $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]); $top = $query->orderBy('views DESC')->offset($pagination->offset)->limit($pagination->limit)->all(); return $this->render('cities', ['top' => $top, 'pagination' => $pagination]); }
public function run() { $query = Top::find(); $top = $query->orderBy('views DESC')->limit(6)->all(); return $this->render('top', ['top' => $top]); }