Answer the question
In order to leave comments, you need to log in
How to implement paginate to multiple pages in laravel?
I use "paginate" but I get "« Previous Next »" in the documentation, I found that I need to use the paginate instance of the "Illuminate\Pagination\LengthAwarePaginator" class instance to list pages, but I can not find an example of how to do this. Larvel 8
Here is the controller code
public function index()
{
$field = [
'id',
'name',
'email',
'created_at'
];
$userQuery = User::select($field);
$userQuery = $this->userService->filter($userQuery);
$userQuery = $this->userService->sort($userQuery);
$users = $userQuery->paginate(2);
return view('admin.user.index', compact('users'));
}
Answer the question
In order to leave comments, you need to log in
You already have a LengthAwarePaginator. So it's the pagination template.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question