Guest User

Untitled

a guest
Jan 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $data = [];
  2. $query = Blog::find()->where(['status'=>1])->multilingual()->orderBy(['id'=>SORT_DESC])->all();
  3.  
  4.  
  5. $count = count($query);
  6.  
  7.  
  8. $pagination = new Pagination(['totalCount' => $count]);
  9.  
  10. // limit the query using the pagination and retrieve the articles
  11. $data['blog'] = $query->offset($pagination->offset)->limit($pagination->limit)->all();
  12.  
  13.  
  14. return $this->render('blog-list',['data'=>$data, 'pagination'=>$pagination]);
Add Comment
Please, Sign In to add comment