@props(['comments', 'level' => 0])
@foreach ($comments as $comment) @php $commentUser = $comment->relationLoaded('user') ? $comment->getRelation('user') : null; $commentAttachments = $comment->relationLoaded('attachments') ? $comment->getRelation('attachments') : collect(); $commentReplies = $comment->relationLoaded('replies') ? $comment->getRelation('replies') : collect(); @endphp
{{ $commentUser?->name ?? 'Unknown user' }}
{{ $comment->created_at?->format('d M Y H:i') }}
@if ($comment->is_internal) Internal @endif
{!! $comment->body !!}
@if ($commentAttachments->isNotEmpty())
@foreach ($commentAttachments as $attachment) {{ $attachment->original_name }} @endforeach
@endif
@if (($reply_parent_id ?? null) === $comment->id)
@endif @if ($commentReplies->isNotEmpty())
@include('helpdesk::partials.comment-thread', [ 'comments' => $commentReplies, 'level' => ((int) $level) + 1, ])
@endif
@endforeach