This package helps you to add user based follow system to your model.
You can install the package using composer
composer require smartisan/follow
Then add the service provider to config/app.php
Smartisan\Follow\FollowServiceProvider::class
Publish the migrations file
php artisan vendor:publish --provider="Smartisan\Follow\FollowServiceProvider" --tag="migrations"
Finally, use FollowTrait in User model
class User extends Model
{
use FollowTrait;
}
$user->follow(1)
$user->follow([1,2,3,4])
$user->unfollow(1)
$user->unfollow([1,2,3,4])
$user->followers()
$user->followings()
$user->isFollowing(1)
$user->isFollowedBy(1)
You can run test by just performing phpunit
command
The MIT License (MIT). Please see License File for more information.