@php $otherUser = (int) $conversation->sender_id === (int) $userId ? $conversation->receiver : $conversation->sender; $isMine = (int) $conversation->sender_id === (int) $userId; $otherName = $otherUser?->username ?: trim(($otherUser?->first_name ?? '') . ' ' . ($otherUser?->last_name ?? '')) ?: 'Unknown User'; $initials = strtoupper(substr($otherName, 0, 2)); $unreadCount = $conversation->unread_count ?? 0; $productTitle = $conversation->product?->details->first()?->title; @endphp
{{-- Avatar --}}
@if($otherUser?->avatar) {{ $otherName }} @else
{{ $initials }}
@endif
{{-- Content --}}
{{ $conversation->updated_at?->diffForHumans() ?? '' }}
{{-- Subject --}} @if($conversation->subject) @endif {{-- Product --}} @if($productTitle)
{{ Str::limit($productTitle, 50) }}
@endif {{-- Actions --}}
@push('styles') @endpush