friendship icon indicating copy to clipboard operation
friendship copied to clipboard

Best practice for get all friends?

Open devillom opened this issue 7 years ago • 0 comments

$friendships = $this->user->getAcceptedFriendships();
foreach ($friendships as $friendship) {
            if ($friendship->sender_id != $this->user->id) {
                $this->friends[] = $friendship->sender()->first();
            } else {
                $this->friends[] = $friendship->recipient()->first();
            }
}
$this->page['friends'] = $this->friends;

devillom avatar Sep 23 '16 12:09 devillom