@props([ 'comment', 'post', 'board', 'depth' => 0, 'authGuard' => 'tenant', 'commentDestroyRoute' => '', 'commentDestroyAction' => '', 'commentReplyEnabled' => true, ]) @php $authorName = $comment->user?->name ?? $comment->guest_name ?? '익명'; $authUser = auth($authGuard)->user(); $canEditComment = auth($authGuard)->check() ? (auth($authGuard)->id() === $comment->user_id || $board->canEditComments($authUser)) : ! $comment->user_id; $canDeleteComment = auth($authGuard)->check() ? (auth($authGuard)->id() === $comment->user_id || $board->canDeleteComments($authUser)) : ! $comment->user_id; @endphp @php $commentDestroyAction = str_contains($commentDestroyAction, '__COMMENT__') ? str_replace('__COMMENT__', (string) $comment->id, $commentDestroyAction) : $commentDestroyAction; $commentDestroyAction = $commentDestroyAction !== '' ? $commentDestroyAction : ($commentDestroyRoute !== '' ? route($commentDestroyRoute, ['board' => $board, 'post' => $post, 'comment' => $comment]) : ''); @endphp
{{ $authorName }} {{ $comment->created_at->diffForHumans() }} @if ($commentReplyEnabled && $board->canWriteComments($authUser)) @endif @if ($canEditComment) @endif @if ($canDeleteComment)
@csrf @method('DELETE') @guest($authGuard) @endguest ×
@endif
{{ $comment->content }}
@if ($comment->children->isNotEmpty())
@foreach ($comment->children as $child) @include('components.posts.comment-item', [ 'comment' => $child, 'post' => $post, 'board' => $board, 'depth' => $depth + 1, 'authGuard' => $authGuard, 'commentDestroyAction' => $commentDestroyAction, 'commentReplyEnabled' => $commentReplyEnabled, ]) @endforeach
@endif