{"repo":"overtrue/laravel-follow","free":true,"listed":false,"github":"https://github.com/overtrue/laravel-follow","clone":"git clone https://github.com/overtrue/laravel-follow.git","description":":heart: This package helps you to add user based follow system to your model.","language":"PHP","stars":1222,"topics":["laravel","followers","follow","like","subscribe","favorite"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Laravel Follow User follow unfollow system for Laravel. Related projects: - Like: overtrue/laravel-like - Favorite: overtrue/laravel-favorite - Subscribe: overtrue/laravel-subscribe - Vote: overtrue/laravel-vote Installing Configuration and Migrations Usage Traits Overtrue\\LaravelFollow\\Traits\\Follower Add the Follower trait to your user model: Overtrue\\LaravelFollow\\Traits\\Followable Then add the Followable trait to your followable model, for example App\\User : or any other model: API Get followings: Get followers: Follow Requests If you would like to have some follow requests to need to be accepted by the user being followed, simply override the needsToApproveFollowRequests() method in the model that uses the Followable trait with your custom logic: Aggregations List with count attribute: Attach user follow status to followable collection You can use Follower::attachFollowStatus(Collection $followables) to attach the user follow status, it will set has followed attribute to each model of $followables : For model For Collection Paginator LengthAwarePaginator array : For pagination Order by followers count You can query users order by followers count with following methods: - orderByFollowersCountDesc() - orderByFollowersCountAsc() - orderByFollowersCount(string $direction = 'desc') example: N+1 issue To avoid the N+1 issue, you can use eager loading to reduce this operation to just 2 queries. When querying, you may specify which relationships should be eager loaded using the","default_branch":null,"files":null,"tree":[],"storefront":"/r/overtrue","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/overtrue/laravel-follow/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}