❤️ This package helps you to add user based follow system to your model.
PHP
Permalink
Failed to load latest commit information.
database/migrations init commit. Nov 11, 2016
src Comment. Nov 12, 2016
tests init commit. Nov 11, 2016
.gitignore init commit. Nov 11, 2016
.php_cs init commit. Nov 11, 2016
LICENSE Add license. Nov 12, 2016
README.md
composer.json remove laravel/laravel from composer.json Jan 2, 2017
phpunit.xml init commit. Nov 11, 2016

README.md

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"

Finally, use FollowTrait in User model

use Overtrue\LaravelFollow\FollowTrait;

class User extends Model
{
    use FollowTrait;
}

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