laravel-acquaintances icon indicating copy to clipboard operation
laravel-acquaintances copied to clipboard

Filter friends

Open kife-design opened this issue 2 years ago • 5 comments

Hello!

First of all, great package.

Is there a way to filter friends? At the moment you have the getFriends() method, but there is no way to say "give me all my friends that are from Belgium" for example.

kife-design avatar Mar 15 '22 07:03 kife-design

Also interested. I don't see an option without editing the source code.

ange007 avatar Jun 05 '22 16:06 ange007

Let me check it out

mkwsra avatar Jun 05 '22 16:06 mkwsra

Honestly, I'm not gonna work on it now, however, I would really appreciate any help (Send me a PR if you can @ange007)

mkwsra avatar Jun 05 '22 16:06 mkwsra

Guys please try this locally, after the PR @ange007 , thankfully, made and let me know so I can create a new version of the library, and then close this issue #86

mkwsra avatar Jun 05 '22 17:06 mkwsra

Example:

$friends = $user->getFriendsQueryBuilder()
                ->where(function($query) use ($query) {
                    $query->where('name', 'LIKE', "{$query}%")
                        ->orWhere('login', 'LIKE', "{$query}%");
                })
                ->paginate($limit);

ange007 avatar Jun 05 '22 19:06 ange007