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
In fact $paginator->getLastPage() > 1 seems to return one even if there is actually 2 pages?
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.
http://laravel.io/forum/12-15-2014-paginator-appends-array-not-working
Paginate like in this link (Nothing Else).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community