2
試圖achiveve(工作正常),但在我的過濾器頁面(http://wasamar.dev/[email protected]@filter?filter=new)我的用戶列表分頁它給我這個錯誤,Macroable.php中的ErrorException第81行:方法lastPage不存在。 ---- laravel 5.2
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)
這是分頁程序渲染
@include('pagination.limit_links', ['paginator' => $newestUsers])
基於該定製分頁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
(Reference作者:Mantas D)然後我試了這個 {{ $newestUsers->links() }}
,我也有這個錯誤。
ErrorException in Macroable.php line 81:
Method links does not exist. (View: C:\laragon\www\wasamar\resources\views\main_app\admin\[email protected])
所以我做錯了什麼?