@props(['comments' => [], 'ticket' => null, 'perPage' => 10]) @php $isPaginated = $comments instanceof \Illuminate\Pagination\Paginator || $comments instanceof \Illuminate\Pagination\LengthAwarePaginator; $commentsList = []; $commentCount = 0; if (is_string($comments)) { $commentsList = []; } elseif ($isPaginated) { $commentsList = $comments->items(); $commentCount = $comments->total(); } elseif (is_array($comments)) { $commentsList = $comments; $commentCount = count($comments); } elseif ($comments instanceof \Illuminate\Support\Collection) { $commentsList = $comments->all(); $commentCount = $comments->count(); } elseif (is_object($comments) && method_exists($comments, 'toArray')) { $commentsList = $comments->toArray(); $commentCount = is_countable($commentsList) ? count($commentsList) : 0; } @endphp
@if($comment->requester_id ?? $comment['requester_id'] ?? null) {{ $comment->requester?->name ?? $comment['requester']['name'] ?? 'Solicitante' }} @else {{ $comment->user?->name ?? $comment['user']['name'] ?? 'Usuario' }} @endif
@php $date = $comment->created_at ?? $comment['created_at'] ?? null; if ($date instanceof \DateTime || $date instanceof \Carbon\Carbon) { echo $date->format('d/m/Y H:i'); } else { echo now()->format('d/m/Y H:i'); } @endphp
Aún no hay comentarios en este ticket.