From 3d745077b79fba2dd99c85aab137b7181a3d8cfa Mon Sep 17 00:00:00 2001 From: manukminasyan Date: Fri, 27 Mar 2026 21:23:18 +0400 Subject: [PATCH] fix: prevent lazy loading violation on replies relationship Check relationLoaded('replies') before accessing $comment->replies to avoid LazyLoadingViolationException when rendering nested comments whose replies aren't eager loaded. --- resources/views/livewire/comment-item.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/comment-item.blade.php b/resources/views/livewire/comment-item.blade.php index 2e08625..4609be1 100644 --- a/resources/views/livewire/comment-item.blade.php +++ b/resources/views/livewire/comment-item.blade.php @@ -142,7 +142,7 @@ @endif {{-- Nested replies --}} - @if ($comment->replies->isNotEmpty()) + @if ($comment->relationLoaded('replies') && $comment->replies->isNotEmpty())
@foreach ($comment->replies as $reply)