Skip to content

Commit 46796dc

Browse files
Remove getFriendsQueryBuilder()
1 parent 04187c8 commit 46796dc

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/Traits/Friendable.php

+2-17
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ public function getFriendRequests()
203203
public function getFriends($perPage = 0)
204204
{
205205
if ($perPage == 0) {
206-
return $this->getFriendsQueryBuilder()->get();
206+
return $this->friendships()->get();
207207
} else {
208-
return $this->getFriendsQueryBuilder()->paginate($perPage);
208+
return $this->friendships()->paginate($perPage);
209209
}
210210
}
211211

@@ -294,21 +294,6 @@ private function findFriendships($status = null)
294294
return $query;
295295
}
296296

297-
298-
/**
299-
* Get the query builder of the 'friend' model
300-
*
301-
* @return \Illuminate\Database\Eloquent\Builder
302-
*/
303-
private function getFriendsQueryBuilder()
304-
{
305-
$friendships = $this->findFriendships(Status::ACCEPTED)->get(['sender_id', 'recipient_id']);
306-
$recipients = $friendships->lists('recipient_id')->all();
307-
$senders = $friendships->lists('sender_id')->all();
308-
309-
return $this->where('id', '!=', $this->getKey())->whereIn('id', array_merge($recipients, $senders));
310-
}
311-
312297
/**
313298
* Get the query builder for friendsOfFriends ('friend' model)
314299
*

0 commit comments

Comments
 (0)