@extends('admin.layout.app') @section('content')
@include('admin.user.header')
@php $friends = \App\Models\FriendShip::where(function ($query) use ($user) { $query->where('sender_id', $user->id) ->orWhere('receiver_id', $user->id); })->get(); @endphp

{{$friends->count()}} Connections

@if($friends->isEmpty()) @else
@foreach($friends->take(12) as $friend) @php // Get the other user (not the current logged-in user) $otherUser = ($friend->sender_id == $user->id) ? $friend->userReceiver : $friend->userSender; @endphp
{{$otherUser->title ?? ''}}
connections
@php $otherUserfriends = \App\Models\FriendShip::where(function ($query) use ($otherUser) { $query->where('sender_id', $otherUser->id) ->orWhere('receiver_id', $otherUser->id); })->get(); @endphp @foreach($otherUserfriends as $otherUserFriend) @php // Get the other user (not the current logged-in user) $otherUserFriendIdentification = ($otherUserFriend->sender_id == $otherUser->id) ? $otherUserFriend->userReceiver : $otherUserFriend->userSender; @endphp
@endforeach
+{{$otherUserfriends->count()}}
@if($friend->status === 'accepted') @else @endif
@endforeach
@if($friends->count() > 1) @endif @endif
@endsection