Skip to content

❤️ This package helps you to add user based follow system to your model.

License

Notifications You must be signed in to change notification settings

gaodevops/laravel-follow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel 5 Follow System

❤️ This package helps you to add user based follow system to your model.

this repo is forked from mohd-isa/follow(deleted).

Installation

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;
}

Usage

Follow a user or users.

$user->follow(1)
$user->follow([1,2,3,4])

Unfollow a user or users.

$user->unfollow(1)
$user->unfollow([1,2,3,4])

Get user followers

$user->followers()

Get user followings

$user->followings()

Check if follow

$user->isFollowing(1)

Check if followed by

$user->isFollowedBy(1)

License

MIT

About

❤️ This package helps you to add user based follow system to your model.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%