friendship
friendship copied to clipboard
Best practice for get all friends?
$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;