Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Zoul's avatar
Level 5

Pagination not working with livewire 3

Hi,

Pagination is not working after upgrading to livewire 3, i got the this error : ``` http://127.0.0.1:8000/en/blog?page=2 `` Page not found

In BlogList component


use Livewire\Component;
use Livewire\WithPagination;
use App\Models\Blog;
use Hashids\Hashids;
class BlogList extends Component
{
    use WithPagination;
    protected $paginationTheme = 'bootstrap';
    public function render()
    {
        $hash = new Hashids('', 10); // pad to length 10
        $blogs = Blog::paginate(6);
        return view('livewire.blog-list',compact('blogs','hash'));

    }
}

In blog-list view blade

<div>
    <!-- Blog -->
   <section class="blog-area three ptb-100">
       <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="row">
                        @if($blogs && $blogs-> count() > 0)
                            @foreach ($blogs as $blog)
                                <div class="col-md-6 col-sm-6 col-lg-4">
                                    <div class="blog-item">
                                        <div class="top">
                                             <a target="_blank" href="{{ $blog->photo}}">
                                                <img src="{{ $blog->photo}}" alt="blog" style="width: 510; height:450" title="{{ $blog->title}}" alt="{{ $blog->title}}">
                                            </a>
                                        </div>
                                        <div class="bottom">
                                            <ul>
                                                <li>
                                                    <i class="icofont-calendar"></i>
                                                    <span>{{ Date::parse($blog->created_at) ? Date::parse($blog->created_at)->diffForHumans() : ''}}</span>
                                                </li>
                                                <li>
                                                    <i class="icofont-user-alt-3"></i>
                                                    <span>{{ trans('front/message.By') }}:</span>
                                                    <a href="#">{{ $blog->user->name}}</a>
                                                </li>
                                            </ul>
                                            <h3>
                                                 <a href="{{ url('blog/details/'.str_replace_me($blog->title).'/'.$hash->encodeHex($blog->id))}}" title="{{ $blog->title}}">{{ $blog->title}}</a>
                                            </h3>
                                             <p>{{ $blog->short_description }}</p>
                                            <a class="blog-btn" href="{{ url('blog/details/'.str_replace_me($blog->title).'/'.$hash->encodeHex($blog->id))}}" title="{{ $blog->title}}">{{ trans('front/message.Read More') }}</a>
                                        </div>
                                    </div>
                                </div>
                            @endforeach
                        @endif
                    </div>
                    <div class="pagination-area">
                        <ul>
                            <li>
                                {{ $blogs->links() }}

                            </li>
                        </ul>
                    </div>
                </div>
            </div>
       </div>
   </section>
   <!-- End Blog -->
</div>

Any idea what is going wrong pls ? Thanks

0 likes
2 replies
Zoul's avatar
Zoul
OP
Best Answer
Level 5

I added this to my route, its working now but it takes like 4 second to render from one page to another

    Livewire::setUpdateRoute(function ($handle) {
        return Route::post('/livewire/update', $handle);

    }); ``` 

1 like

Please or to participate in this conversation.