binggle's avatar

Multiple paginations not working .

Comment.php

class UpsoComments extends Component
{
    use CommentsTrait;

    function render(){
        return view('comments', [
            'comments'=> $this->getComments( $post) 
        ]);
    }
}

CommentsTrait.php

trait CommentsTrait
{
    use WithPagination;

    function getComments($commentable){
        return Comment::query()
                    ->paginate(3, ['*'], 'commentsPage');
    }
}

comments.blade.php

<div class="">
    @foreach ($comments as $item)
        <div> {{ $item->content }}</div>
    @endforeach
    <div >
        {{ $comments->links() }}
    </div>
</div>

That Component/View is seen on Modal.

When I click 2 page, the querystring add '&page=2' and there is no display of second page of comments.

https://laravel-livewire.com/docs/2.x/pagination

As following the document, It should be '&commentsPage=2'.

Can someone point out where I miss ?

0 likes
2 replies
binggle's avatar

@webrobert sure

composer show | grep livewire
livewire/livewire                           v2.6.7     A front-end framework for Laravel.

Please or to participate in this conversation.