According to the documentation for Laravel 5.3 you can customize the view of the following form:
Running the artisan
command to carry the default view
of pagination to resources/views/vendor/pagination
:
php artisan vendor:publish --tag=laravel-pagination
From there, just edit the content HTML
of your default.blade.php
, which corresponds to the default pagination.
According to the documentation, you can customize your own features of view
using the following methods:
$results->count()
$results->currentPage()
$results->firstItem()
$results->hasMorePages()
$results->lastItem()
$results->lastPage() (Not available when using simplePaginate)
$results->nextPageUrl()
$results->perPage()
$results->previousPageUrl()
$results->total() (Not available when using simplePaginate)
$results->url($page)
- Note that in the case of your question, using
simplePaginate()
, some methods are not available!
For pagination in the Laravel 5.2 and earlier
It is enough that instead of using the render()
method, do the following:
@include('paginacao.default', ['paginator' => $artigos]) //onde o primeiro parâmetro é o caminho da sua view
And customize it by creating your blade, for example:
@if ($paginator->lastPage() > 1)
<ul class="pagination">
<li class="{{ ($paginator->currentPage() == 1) ? ' disabled' : '' }}">
<a href="{{ $paginator->url(1) }}">Previous</a>
</li>
@for ($i = 1; $i <= $paginator->lastPage(); $i++)
<li class="{{ ($paginator->currentPage() == $i) ? ' active' : '' }}">
<a href="{{ $paginator->url($i) }}">{{ $i }}</a>
</li>
@endfor
<li class="{{ ($paginator->currentPage() == $paginator->lastPage()) ? ' disabled' : '' }}">
<a href="{{ $paginator->url($paginator->currentPage()+1) }}" >Next</a>
</li>
</ul>
@endif
Where for this release the available methods are:
$results->count()
$results->currentPage()
$results->firstItem()
$results->hasMorePages()
$results->lastItem()
$results->lastPage() (Not available when using simplePaginate)
$results->nextPageUrl()
$results->perPage()
$results->previousPageUrl()
$results->total() (Not available when using simplePaginate)
$results->url($page)