Support the ongoing development of Laravel.io →
Views Blade

Ok so I swear this was working about 2 months, but I have returned to the project, run composer update and now my custom paginator view no longer displays. Pagination works though, if I manually enter ?page=2 on the end I get the next set of results.

Calling the pagination template from index.blade.php:

{{ $objects->links('admin::admin._partials.buttons.pagination') }}

And within admin._partials.buttons.pagination.blade.php I have:

@if ($paginator->getLastPage() > 1)
    <div class="btn-group pull-right">
        <a href="{{ $paginator->getUrl(1) }}" class="btn btn-white{{ ($paginator->getCurrentPage() == 1) ? ' disabled' : '' }}" type="button"><i class="fa fa-chevron-left"></i></a>
        @for ($i = 1; $i <= $paginator->getLastPage(); $i++)
            <a href="{{ $paginator->getUrl($i) }}" class="btn btn-white{{ ($paginator->getCurrentPage() == $i) ? ' active' : '' }}">{{ $i }}</a>
        @endfor
        <a href="{{ $paginator->getUrl($paginator->getCurrentPage()+1) }}" class="btn btn-white{{ ($paginator->getCurrentPage() == $paginator->getLastPage()) ? ' disabled' : '' }}" type="button"><i class="fa fa-chevron-right"></i> </a>
    </div>
@endif
Last updated 3 years ago.
0

In fact $paginator->getLastPage() > 1 seems to return one even if there is actually 2 pages?

0

Did you update to Laravel 5?

The pagination has changed:

http://laravel.com/docs/5.0/pagination

0

No I havn't updated yet, this is in Laravel 4.2.16

0

Just so it's clear, this was working up until recently (I believe). Also, using ->links() is rendering the view which is great, the issue seems to be with the following line:

($paginator->getLastPage() > 1)

This is currently returning 1 when there are in fact two pages.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.