lat4732's avatar
Level 12

How to set max possible pages display of the pagination

Hello everyone!

Quick look at this photo is showing the problem

viz1

Here is how I'm currently paginating the results

$logs = CompanyActionsLog::where('company_id', $companyData->id)->orderBy('spent_at', 'DESC')->where('type', 'decrement')->where('is_system_log', 0)->paginate(3, ['*'], 'logsPage')->onEachSide(1);

How can I fix this problem? onEachSide() doesn't help in my case. I want to somehow set how many pages can be maximum displayed.

0 likes
3 replies
Lara_Love's avatar

paginate(1); dosent work in your controller ?

you have to add one line code to the app/Providers/AppServiceProvider.php file. Just use the below codes inside the boot() method.

Paginator::useBootstrap();

lat4732's avatar
Level 12

@LoverCode paginate(1); is showing 1 result per page. It has nothing to do with the PAGINATION DISPLAYED NUMBER OF PAGES. I'm already using bootstrap for my paginators.

Please or to participate in this conversation.