'pagination' => 'pagination.custom'
Create a file custom.php in views/pagination/ and copy this in (modify as needed):
<?php
$presenter = new Illuminate\Pagination\BootstrapPresenter($paginator);
?>
<?php if ($paginator->getLastPage() > 1): ?>
<div class="pagination">
<ul>
<?php echo $presenter->render(); ?>
</ul>
</div>
<?php endif; ?>
Save the ZurbPresenter.php in app/{your_project_name_or_something}/Presenters/ and paste code:
<?php
namespace {your_project_name_or_something}\Presenters;
class ZurbPresenter extends \Illuminate\Pagination\Presenter {
public function getActivePageWrapper($text)
{
return '<li class="current"><a href="">'.$text.'</a></li>';
}
public function getDisabledTextWrapper($text)
{
return '<li class="unavailable">'.$text.'</li>';
}
public function getPageLinkWrapper($url, $page, $rel = null)
{
return '<li><a href="'.$url.'">'.$page.'</a></li>';
}
}
I added the namespace (modify it) and $rel = null because it's throwing an error without it.
Modify composer.json:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-4": {
"{your_project_name_or_something}\\": "app/"
}
},
After that open command line and cd to project dir and run "composer dump-autoload -o"
{{ with(new {your_project_name_or_something}\Presenters\ZurbPresenter($models))->render() }}
I hope I haven't missed anything.
Great. Thanks man. This totally works. But one more thing - When it render the pagination it look like this ->
« 1 2 »
How can I remove the '« »' symbols?
To remove the unclickable one use "return null;" on getDisabledTextWrapper. I haven't figured out the ones that are links.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community