@php $status = $comment->status ?? 'active'; $badgeClass = $status === 'active' ? 'bg-success' : ($status === 'pending' ? 'bg-warning text-dark' : 'bg-secondary'); $canEdit = auth()->check() && (auth()->id() === $comment->user_id || Gate::allows('delete-comment', [$comment, $comment->commentable])); $canDelete = auth()->check() && (auth()->id() === $comment->user_id || Gate::allows('delete-comment', [$comment, $comment->commentable])); $canVote = auth()->check() && auth()->id() !== $comment->user_id; $userVote = auth()->check() ? $comment ->votes() ->where('user_id', auth()->id()) ->first() : null; $canReply = Gate::allows('reply-comment', [$comment, $comment->commentable]); // Background color for unapproved comments $bgClass = $comment->is_approved ? '' : 'bg-light-subtle'; $isAnswer = $comment->is_answer ?? false; $totalScore = ($comment->upvote_count ?? 0) - ($comment->downvote_count ?? 0); // Determine score badge color $scoreBadgeClass = 'bg-secondary'; if ($totalScore > 0) { $scoreBadgeClass = 'bg-success'; } elseif ($totalScore < 0) { $scoreBadgeClass = 'bg-danger'; } // Check if user can perform admin actions $isAdminOrModerator = Gate::allows('admin-action', $comment); $isThreadOwner = auth()->check() && auth() ->user() ->can('markAnswer', [$comment->commentable, $comment]); // Comment border based on status @endphp @push('css') @endpush
{{ $commentUser?->name }}
{{ $comment->created_at->diffForHumans() }} @if ($comment->updated_at != $comment->created_at) {{ __('labels.edited') }} @endif{{ $commentUser?->name }}
{{ $comment->created_at->diffForHumans() }} @if ($comment->updated_at != $comment->created_at) {{ __('labels.edited') }} @endif{{-- Report Option --}} {{---
{{ __('labels.report') }}
--}}
{{-- Share Option --}}
{{-- -
{{ __('labels.share') }}
--}}
{{--
--}}
{{-- Delete Option --}}
@if (Gate::allows('delete-comment', $comment))
-
{{ __('labels.delete') }}
@endif
{{ __('labels.edit_comment') }}