@if($rooms) @foreach($rooms as $room) @php( $user_id = Auth::user()->id)
  • {{-- {{asset('images/users/'. $room->sender->image)}}--}} avatar
    {{-- {{$room->sender_id != $user_id ? $room->sender->name ? $room->sender->name : $room->sender->email : $room->receiver->name ? $room->receiver->name : $room->receiver->email }}--}} @if($room->sender_id == $user_id) {{$room->receiver->name}} @elseif($room->receiver_id == $user_id) {{$room->sender->name}} @endif
    {{$room->messages()->latest()->value('created_at') ? \Carbon\Carbon::parse($room->messages()->latest()->value('created_at'))->diffForHumans() : \Carbon\Carbon::parse($room->created_at)->diffForHumans() }}

    {{$room->messages()->latest()->value('body') ? $room->messages()->latest()->value('body') : ''}}

  • @endforeach @else

    لا يوجد مستخدم بهذا الاسم

    @endif