Support the ongoing development of Laravel.io →
Views Blade

I have a view in (inbox/pagination.blade.php)

Here is the contents

@if($paginator->getLastPage() > 1)
    <span class="text-muted"><strong>{{ $paginator->getFrom() }} - {{ $paginator->getTo() }}</strong> of <strong>{{ $paginator->total() }}</strong></span>
    <div class="btn-group btn-group">
        <a href="{{ $paginator->getUrl(1) }}" class="btn btn-dark {{ ($paginator->getCurrentPage() == 1) ? ' disabled' : '' }}"><span class="fa fa-chevron-left"></span></a>
        <a href="{{ $paginator->getUrl($paginator->getCurrentPage()+1) }}" class="btn btn-dark {{ ($paginator->getCurrentPage() == $paginator->getLastPage()) ? ' disabled' : '' }}"><span class="fa fa-chevron-right"></span></a>
    </div>
@endif

In my inbox blade, I render the pagination with

{{ $conversations->links('inbox.pagination') }}

but it returns the following error

Method Illuminate\View\View::__toString() must not throw an exception

From all the tutorials I have found on customizing pagination, they only allowed you to change the wrapping element and not the actual links, and how they are displayed. How can I use my custom view to render my pagination links?

I do not want to override the default pagination, only the pagination for specific blades. (hence the view passed to the links in the blade)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.