A User Follow Package for Laravel 5
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
Add a user following system like Twitter, Quora or any other social network that allows you to follow another user and have users follow you., (*2)
Install
You can install the package via composer:, (*3)
``` bash
$ composer require jeroenherczeg/dog, (*4)
Next, you must install the service provider:
``` php
// config/app.php
'providers' => [
...
Jeroenherczeg\Dog\FollowServiceProvider::class,
];
You can publish the migration with:, (*5)
``` bash
php artisan vendor:publish --provider="Jeroenherczeg\Dog\FollowServiceProvider", (*6)
After the migration has been published you can create the `followers` table by running the migrations:
```bash
php artisan migrate
Add the followable trait to the User model
``` php
use Jeroenherczeg\Dog\Followable;, (*7)
class User extends Model
{
use Followable;
..., (*8)
## Usage
``` php
// Follow User
$user->follow(1)
$user->follow([1,2,3,4])
// Unfollow User
$user->unfollow(1)
$user->unfollow([1,2,3,4])
// Get Followers
$user->followers()
// Get Followings
$user->followings()
// Check if Follow
$user->isFollowing(1)
// Check if Followed By
$user->isFollowedBy(1)
Change log
Please see CHANGELOG for more information what has changed recently., (*9)
Testing
bash
$ composer test
, (*10)
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*11)
Security
If you discover any security related issues, please email jeroen@herczeg.be instead of using the issue tracker., (*12)
Credits
License
The MIT License (MIT). Please see License File for more information., (*13)
Why Dog?
Your dog follows you because it's highly social - has a powerful emotional need for companionship - and knows that you are super-cool. You are the source of all good things in its life: food, walks, rides, treats, toys. Who knows what amazing thing will happen wherever you're going?, (*14)