I created a FoundationFivePresenter by extending the BootstrapThreePresenter and just changing the getDisabledTextWrapper and getActivePageWrapper and placed it in /app/Pagination.
namespace App\Pagination;
use Illuminate\Pagination\BootstrapThreePresenter;
class FoundationFivePresenter extends BootstrapThreePresenter
{
/**
* Get HTML wrapper for disabled text.
*
* @param string $text
* @return string
*/
protected function getDisabledTextWrapper($text)
{
return '<li class="unavailable"><span>'.$text.'</span></li>';
}
/**
* Get HTML wrapper for active text.
*
* @param string $text
* @return string
*/
protected function getActivePageWrapper($text)
{
return '<li class="current"><span>'.$text.'</span></li>';
}
}
I found where the presenter is set:
public function render(Presenter $presenter = null)
{
if (is_null($presenter) && static::$presenterResolver) {
$presenter = call_user_func(static::$presenterResolver, $this);
}
$presenter = $presenter ?: new BootstrapThreePresenter($this);
return $presenter->render();
}
But I didn't want to instantiate my presenter and pass it to render in the view. So I looked at LengthAwarePaginator, since in my controller I'm calling User::paginate(15) and not using the SimplePaginator, and the only other way to set $presenterResolver seems to be by extending LengthAwarePaginator and setting it to default to a new instance of FoundationFivePresenter in render, or somehow instantiating LengthAwarePaginator and calling presenter passing in a new instance of my presenter which seems even more cumbersome.
Is there an easier way to use a custom paginator in Laravel 5.1 that doesn't involve passing in an instance in a view? I checked the config files for a setting just in case.