Initial Ticket
{{ $ticket->created_at->format('d M Y H:i') }}
{{ $ticket->description }}
@if($ticket->initialPhoto)
@endif
@php
$allResponses = collect();
// Add admin responses
if($ticket->admin_responses) {
foreach($ticket->admin_responses as $response) {
$allResponses->push([
'type' => 'admin',
'content' => $response,
'timestamp' => \Carbon\Carbon::parse($response['timestamp'])
]);
}
}
// Add user replies
if($ticket->user_replies) {
foreach(json_decode($ticket->user_replies, true) as $reply) {
$allResponses->push([
'type' => 'user',
'content' => $reply,
'timestamp' => \Carbon\Carbon::parse($reply['timestamp'])
]);
}
}
// Sort all responses by timestamp (newest first)
$allResponses = $allResponses->sortByDesc('timestamp');
@endphp
@foreach($allResponses as $response)
@if($response['type'] === 'admin')
Admin Response
@else
@if(isset($response['content']['type']))
{{ ucfirst($response['content']['type']) }} Response
@else
User Reply
@endif
@endif
{{ $response['timestamp']->format('d M Y H:i') }}
@if($response['type'] === 'admin')
{{ $response['content']['notes'] }}
@else
{{ isset($response['content']['notes']) ? $response['content']['notes'] : $response['content']['message'] }}
@endif
@if(isset($response['content']['photo']))
@endif
@endforeach
@if($ticket->in_progress_at)
Status Changed: In Progress
{{ $ticket->in_progress_at->format('d M Y H:i') }}
@endif
@if($ticket->closed_at)
Status Changed: Closed
{{ $ticket->closed_at->format('d M Y H:i') }}
@endif