Closed mirdostogir closed 4 years ago
You are using $model->Comments
(First letter is uppercase), when you should be using $model->comments
(lowercase).
using $model->comments (lowercase). but get same error
Is the error now about the lowercase or uppercase? Why is it complaining about stdclass? Have you checked that you are passing the correct model.
Have you tried using the default views that came with this package? It looks like you are using your modified views.
I have the same issue, Any solution yet ?
``@php
@endphp
@if($comments->count() < 1)
@endif
@php $comments = $comments->sortBy('created_at'); if (isset($perPage)) { $page = request()->query('page', 1) - 1; $parentComments = $comments->where('child_id', ''); $slicedParentComments = $parentComments->slice($page * $perPage, $perPage); $slicedParentCommentsIds = $slicedParentComments->pluck('id')->toArray(); $comments = $comments // Remove parent Comments from comments ->whereNotIn('id', $slicedParentCommentsIds) // Keep only comments that are related to spliced parent comments. // This maybe improves performance? ->whereIn('child_id', $slicedParentCommentsIds); $grouped_comments = new \Illuminate\Pagination\LengthAwarePaginator( $slicedParentComments->merge($comments)->groupBy('child_id'), $parentComments->count(), $perPage );