Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function popularNews($lan){
- $this->lan = $lan;
- $query = TblPost::query();
- $query->inRandomOrder();
- $perPage = 9;
- $total = $query->count();
- $page = request()->input('page', 1);
- $query->orderBy('id', 'DESC');
- $data = $query->offset(($page - 1) * $perPage)->limit($perPage)->get();
- return [
- 'data' => $this->getCollections($data),
- 'total' => $total,
- 'page' => $page,
- 'last_page' => ceil($total / $perPage)
- ];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement