@props(['comment', 'level' => 0]) @php // Check if this comment or any of its descendants are not deleted $hasNonDeletedDescendants = false; if ($comment->deleted_at === null) { $hasNonDeletedDescendants = true; } else { // Check if any children are not deleted foreach ($comment->children as $child) { if ($child->deleted_at === null) { $hasNonDeletedDescendants = true; break; } // Recursively check grandchildren if (count($child->children) > 0) { foreach ($child->children as $grandchild) { if ($grandchild->deleted_at === null) { $hasNonDeletedDescendants = true; break 2; } } } } } @endphp @if($hasNonDeletedDescendants)
{{ $comment->title ?? 'Unknown User' }}
@if($comment->deleted_at) Comment deleted @else {{ $comment->body }} @endif
@if($comment->children->isNotEmpty() && $comment->children->whereNull('deleted_at')->isNotEmpty()) @endif
@if(!$comment->deleted_at && $this->replyingToCommentId === $comment->id)
@endif @if($comment->children->isNotEmpty() && $this->isExpanded($comment->id)) @foreach($comment->children as $child) @endforeach @endif
@endif