Trying to achiveve the pagination of my user list (working fine), but on my filter page ( http://wasamar.dev/admin@users@filter?filter=new ) it give me this error,
ErrorException in Macroable.php line 81:
Method lastPage does not exist. (View: C:\laragon\www\wasamar\resources\views\pagination\limit_links.blade.php) (View: C:\laragon\www\wasamar\resources\views\pagination\limit_links.blade.php)
This is the paginator render
@include('pagination.limit_links', ['paginator' => $newestUsers])
THE CUSTOM PAGINATION VIEW
<!--
https://stackoverflow.com/questions/28240777/custom-pagination-view-in-laravel-5
Author: Mantas D
-->
<?php
// config
$link_limit = 7; // maximum number of links (a little bit inaccurate, but will be ok for now)
?>
@if ($paginator->lastPage() > 1)
<div class="pagination-centered">
<ul class="pagination">
<li class="montserrat-font {{ ($paginator->currentPage() == 1) ? ' unavailable' : '' }}">
<a href="{{ $paginator->url(1) }}">First</a>
</li>
@for ($i = 1; $i <= $paginator->lastPage(); $i++)
<?php
$half_total_links = floor($link_limit / 2);
$from = $paginator->currentPage() - $half_total_links;
$to = $paginator->currentPage() + $half_total_links;
if ($paginator->currentPage() < $half_total_links) {
$to += $half_total_links - $paginator->currentPage();
}
if ($paginator->lastPage() - $paginator->currentPage() < $half_total_links) {
$from -= $half_total_links - ($paginator->lastPage() - $paginator->currentPage()) - 1;
}
?>
@if ($from < $i && $i < $to)
<li class="montserrat-font {{ ($paginator->currentPage() == $i) ? ' current' : '' }}">
<a href="{{ $paginator->url($i) }}">{{ $i }}</a>
</li>
@endif
@endfor
<li class="montserrat-font {{ ($paginator->currentPage() == $paginator->lastPage()) ? ' unavailable' : '' }}">
<a href="{{ $paginator->url($paginator->lastPage()) }}">Last</a>
</li>
</ul>
</div>
@endif
based on this ( Reference Author: Mantas D ) Then i tried this
{{ $newestUsers->links() }}
and i got this error too.
ErrorException in Macroable.php line 81:
Method links does not exist. (View: C:\laragon\www\wasamar\resources\views\main_app\admin\users@filter.blade.php)
so what did i do wrong?