lilo's avatar
Level 2

Laravel Pagination Problem

Hi,

I want to paginate my blade.

My route:

Route::get('/publicatons', function () {
$publications = Publications::orderBy('date','DESC')->paginate(5);
return view('our_publications',['publications'=>$publications]);});

My blade:

<section>
    <div class="container">
        <div class="row">
            <div class="masonry masonry-blog">
                <div class="masonry__container masonry--animate">
                    @foreach($publications as $publication)
                    <div class="col-md-6 col-sm-6 masonry__item">
                            <div class="card card-4">
                                <div class="card__image">
                                    <img alt="Pic" src="{{ $publication->photo->first()->url }}" height="350px" width="600px"/>
                                </div>
                                <div class="card__body boxed boxed--sm bg--white">
                                    <div class="card__title">
                                        <h5>{!! $publication->text !!}</h5>
                                    </div>
                                    <hr>
                                    <div class="card__lower">
                                        <span class="h6">{{ $publication->date }}</span>
                                    </div>
                                </div>
                            </div>
                        </a>
                    </div>
                    @endforeach
                </div>
                <!--end masonry container-->
            </div>
            <!--end masonry-->
        </div>
        //Here is my links
        <div class="d-flex justify-content-center">
            {{ $publications->links() }}
        </div>
    </div>
    <!--end of container-->
</section>

Links work fine but instead of page numbers, it writes "gghgh hjhjhjh»". And When I do pagination, I get [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. error on console. How can I change them into numbers and fix this?

0 likes
4 replies
CorvS's avatar

What Laravel Version? Have you considered:

Remember, the HTML generated by the links method is compatible with the Tailwind CSS framework.

Since your classes look like Bootstrap to me

lilo's avatar
Level 2

Hi @nimrod thanks for answering. I use Laravel 8. And what do you mean saying this:

Remember, the HTML generated by the links method is compatible with the Tailwind CSS framework.

CorvS's avatar

That the line {{ $publications->links() }} doesn't work with Bootstrap out of the box, you have to configure it first. See @newbie360's answer for that.

Please or to participate in this conversation.