{{ date_format($ticket->created_at, 'l, Y-m-d') }}
{{ $ticket->message }}
{{ date_format($ticket->created_at, 'H:i A') }}
@php
$all_comments = $ticket
->comments()
->orderBy('created_at')
->get()
->groupBy(function ($query) {
return date_format($query->created_at, 'l, Y-m-d');
});
@endphp
@foreach ($all_comments as $day => $comments)
{{ $day }}
@foreach ($comments as $comment)
@if ($comment->user_type == 'admin')
{{ $comment->message }}
{{ date_format($comment->created_at, 'H:i A') }}
@else
{{ $comment->message }}
{{ date_format($comment->created_at, 'H:i A') }}
@endif
@endforeach
@endforeach