Closed sarik-k closed 2 years ago
Thanks a lot for reporting this, you are totally right, please edit the file src/Traits/Friendable.php
And add this function to it:
/**
* Get the number of pending requests
*
* @param string $groupSlug
*
* @return integer
*/
public function getPendingsCount($groupSlug = '')
{
$friendsCount = $this->findFriendships(Status::PENDING, $groupSlug)->count();
return $friendsCount;
}
And I will be adding this function to the library and make a new release soon :) Thanks again for your help
You're welcome :)
Seems like it calculates for both Incoming and Outgoing requests. I only need the former - how many pending friend requests a user has.
Doing this in my controller for now:
$count = $request->user()->getFriendRequests()->count();
Awesome, you are already doing it correctly!
And thank you so much for your star, much appreciated 🙏
Documentation says its there but its not.