❤️ This package helps you to add user based follow system to your model.
this repo is forked from mohd-isa/follow(deleted).
You can install the package using composer
$ composer require overtrue/laravel-follow -vvv
Then add the service provider to config/app.php
Overtrue\LaravelFollow\FollowServiceProvider::class
Publish the migrations file:
$ php artisan vendor:publish --provider="Overtrue\LaravelFollow\FollowServiceProvider" --tag="migrations"
And create tables:
$ php artisan migrate
Finally, use CanFollow
and CanBeFollowed
in User model:
use Overtrue\LaravelFollow\CanFollow;
use Overtrue\LaravelFollow\CanBeFollowed;
class User extends Model
{
use CanFollow, CanBeFollowed;
}
$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)
MIT