- create new file for example
CustomPaginationPresenter.php
belowapp
directory - Extends the class from
SimpleBootstrapThreePresenter
like so:
<?php
namespace App;
use Illuminate\Support\HtmlString;
use Illuminate\Pagination\SimpleBootstrapThreePresenter;
class CustomPaginationPresenter extends SimpleBootstrapThreePresenter
{
/**
* Convert the URL window into Bootstrap HTML.
*
* @return \Illuminate\Support\HtmlString
*/
public function render()
{
if ($this->hasPages()) {
return new HtmlString(sprintf(
'<ul class="my-custom-pagination-class">%s %s %s</ul>',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
));
}
return '';
}
}
- In the view file we can call like so:
{!! $contacts->appends( Request::query() )->render( new \App\CustomPaginationPresenter($contacts) ) !!}
- That's it. For customing other pagination style you can copy the code from
SimpleBootstrapThreePresenter
and redefine/ override in your own class with your style.