@php $forceEnabled = $forceEnabled ?? false; $commentsEnabled = false; if (isset($article) && $article->section) { // Seções especiais que sempre permitem comentários $specialSections = ['bastidores-da-politica', 'coluna-do-holanda']; $isSpecialSection = in_array($article->section->slug, $specialSections); $commentsEnabled = $forceEnabled || $isSpecialSection || $article->section->comments_enabled; } $comments = []; if ($commentsEnabled) { $comments = \App\Models\Comment::with(['approvedReplies', 'user']) ->where('article_id', $article->id) ->where('status', 'approved') ->whereNull('parent_id') ->orderBy('created_at', 'desc') ->get(); } @endphp @if($commentsEnabled)

Comentários ({{ $comments->count() }})

Deixe seu comentário

@csrf
Resolva a operação matemática acima
@if($comments->count() > 0) @foreach($comments as $comment)
{{ $comment->author_name }} {{ $comment->created_at->format('d/m/Y H:i') }}
{!! nl2br(e($comment->content)) !!}
@if($comment->approvedReplies && $comment->approvedReplies->count() > 0)
@foreach($comment->approvedReplies as $reply)
{{ $reply->author_name }} {{ $reply->created_at->format('d/m/Y H:i') }}
{!! nl2br(e($reply->content)) !!}
@endforeach
@endif
@endforeach @else
Seja o primeiro a comentar!
@endif
@endif