@php $authUser = auth()->check() ? auth()->user() : null; $authUserId = !empty($authUser) ? $authUser->getAuthIdentifier() : 0; $thread ??= []; $message ??= []; $filePath = data_get($message, 'file_path'); @endphp @if ($authUserId == data_get($message, 'user.id'))
{!! urlsToLinks(nlToBr(data_get($message, 'body')), ['class' => 'text-light']) !!} @if (!empty($filePath) && $disk->exists($filePath)) @php $mt2Class = !empty(trim(data_get($message, 'body'))) ? 'mt-2' : ''; @endphp @endif
{{ data_get($message, 'created_at_formatted') }} @php $recipient = data_get($message, 'p_recipient'); $threadUpdatedAt = new \Illuminate\Support\Carbon(data_get($thread, 'updated_at')); $threadUpdatedAt->timezone(\App\Helpers\Date::getAppTimeZone()); $recipientLastRead = new \Illuminate\Support\Carbon(data_get($recipient, 'last_read')); $recipientLastRead->timezone(\App\Helpers\Date::getAppTimeZone()); $threadIsUnreadByThisRecipient = ( !empty($recipient) && ( data_get($recipient, 'last_read') === null || $threadUpdatedAt->gt($recipientLastRead) ) ); @endphp @if ($threadIsUnreadByThisRecipient)   @endif
@else
{{ data_get($message, 'user.name') }}
{!! urlsToLinks(nlToBr(data_get($message, 'body'))) !!} @if (!empty($filePath) && $disk->exists($filePath)) @php $mt2Class = !empty(trim(data_get($message, 'body'))) ? 'mt-2' : ''; @endphp @endif
@php $userIsOnline = isUserOnline(data_get($message, 'user')); @endphp @if ($userIsOnline)   @endif {{ data_get($message, 'created_at_formatted') }}
@endif