@foreach($replies->reverse() as $reply)
@php
$isRequester = $reply->user_id === $reply->ticket->user_id;
preg_match_all('/
![]()
]+src="([^"]+)"[^>]*>/', $reply->content, $imageMatches);
$allImages = $imageMatches[1] ?? [];
$imageCount = count($allImages);
$content = preg_replace_callback('/
![]()
]+)src="([^"]+)"([^>]*)>/', function($matches) use ($allImages, $imageCount) {
$escapedUrl = str_replace("'", "\\'", $matches[2]);
$escapedImages = str_replace('"', '"', json_encode($allImages));
$additionalStyles = '';
if ($imageCount > 1) {
$additionalStyles = 'border:2px solid #f59e0b;box-shadow:0 4px 6px -1px rgba(245, 158, 11, 0.3);';
}
return '
![]()
';
}, $reply->content);
@endphp
{{ strtoupper(substr(daacreators\CreatorsTicketing\Support\UserNameResolver::resolve($reply->user) ?? 'U', 0, 1)) }}
{!! $content !!}
@if($imageCount > 1)
{{ $imageCount }} 📷
@endif
@php
$now = \Carbon\Carbon::now();
$diffInMinutes = $reply->created_at->diffInMinutes($now);
@endphp
@if($diffInMinutes < 60)
{{ $reply->created_at->diffForHumans() }}
@else
{{ $reply->created_at->format('M d, H:i') }}
@endif
@endforeach