@if (auth()->check())
@if ($ticket->contact->last_name) {{ucfirst($ticket->contact->first_name[0])}}{{ucwords($ticket->contact->last_name[0])}} @else {{ucfirst($ticket->contact->first_name[0])}}{{ucfirst($ticket->contact->first_name[1])}} @endif
@else
@if ($ticket->user && $ticket->user->profile_picture) Avatar @elseif($ticket->user) {{$ticket->user->name[0].$ticket->user->surname[0]}} @else {{ucwords($ticket->client->name[0])}}{{ucfirst($ticket->client->name[1])}} @endif
@endif Active
@if(!auth()->check())
@if ($ticket->client->logo) Avatar @else {{ucwords($ticket->client->name[0])}}{{ucfirst($ticket->client->name[1])}} @endif
Admin
{{\Carbon\Carbon::parse($ticket->created_at)->format('h:i A')}}
Hi {{$ticket->contact->first_name}}, how can we help you?
@endif
@foreach($this->datedMessages as $key => $conversations)
@if (\Carbon\Carbon::today()->format('Y-m-d') === \Carbon\Carbon::parse($key)->format('Y-m-d')) Today, {{\Carbon\Carbon::parse($key)->format('d M, Y')}} @elseif(\Carbon\Carbon::yesterday()->format('Y-m-d') === \Carbon\Carbon::parse($key)->format('Y-m-d')) Yesterday, {{\Carbon\Carbon::parse($key)->format('d M, Y')}} @else {{\Carbon\Carbon::parse($key)->format('d M, Y')}} @endif
@foreach ($conversations as $message)
@if(auth()->check())
@if($message->user)
@if ($message->user->profile_picture) Avatar @else {{ucfirst($message->user->name[0])}}{{ucwords($message->user->surname[0])}} @endif
@if($message->user->id === auth()->id()) You @else {{$message->user->name}} {{$message->user->surname}} @endif
{{\Carbon\Carbon::parse($message->created_at)->format('h:i A')}}
{{$message->message}}
@else
{{ucfirst($message->contact->first_name[0])}}{{ucwords($message->contact->last_name[0])}}
{{$message->contact->first_name}} {{$message->contact->last_name}}
{{\Carbon\Carbon::parse($message->created_at)->format('h:i A')}}
{{$message->message}}
@endif
@else
@if($message->user)
@if ($message->user->profile_picture) Avatar @else {{ucfirst($message->user->name[0])}}{{ucwords($message->user->surname[0])}} @endif
{{$message->user->name}} {{$message->user->surname}}
{{\Carbon\Carbon::parse($message->created_at)->format('h:i A')}}
{{$message->message}}
@else
{{ucfirst($message->contact->first_name[0])}}{{ucwords($message->contact->last_name[0])}}
{{$message->contact->first_name}} {{$message->contact->last_name}}
{{\Carbon\Carbon::parse($message->created_at)->format('h:i A')}}
{{$message->message}}
@endif
@endif
@endforeach
@endforeach