Level 51
@binggle you're using v2.6.0?
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 ?
Please or to participate in this conversation.