@php $status = $comment->status ?? 'active'; $badgeClass = $status === 'active' ? 'bg-success' : ($status === 'pending' ? 'bg-warning text-dark' : 'bg-secondary'); // Check if current user can edit/delete this comment $canEdit = auth()->check() && (auth()->id() === $comment->user_id || auth()->user()->can('update', $post, $comment)); $canDelete = auth()->check() && (auth()->id() === $comment->user_id || auth()->user()->can('delete', $post, $comment)); @endphp
{{ $comment?->user?->name }}
{{ $comment?->user?->name }}
@if($comment->status == 'draft' || $comment->status == 'published') {{ ucfirst($comment->status == 'published' ? 'pending' : $comment->status) }} @endif
{{ $comment->created_at->diffForHumans() }} @if($comment->updated_at != $comment->created_at) (edited {{ $comment->updated_at->diffForHumans() }}) @endif
{{-- Comment Actions Dropdown --}} @if($canEdit || $canDelete) @endif
{{-- Comment Content Display --}}

{!! nl2br(e($comment->content)) !!}

{{-- Edit Comment Form (Hidden by default) --}}
@csrf @method('PUT')
{{ strlen($comment->content) }}/2000 {{ __('labels.characters') }}
{{-- Reply Button --}} @auth @if($depth < 2)
{{ __('labels.reply') }}
@endif @endauth {{-- Reply Form --}}
@csrf
0/2000 {{ __('labels.characters') }}
{{-- Recursively render child comments --}} @if($comment->children && $comment->children->count() > 0)
@foreach($comment->children->sortBy('created_at') as $childComment) @include('pages.posts.templates.comments.comment',[ 'comment' => $childComment, 'depth' => $depth + 1, 'marginLeft' => $marginLeft+10, ]) @endforeach
@endif