Require this package, with Composer, in the root directory of your project.
$ composer require faustbrian/laravel-friendableTo get started, you'll need to publish the vendor assets and migrate:
php artisan vendor:publish --provider="BrianFaust\Friendable\FriendableServiceProvider" && php artisan migrate
<?php
namespace App;
use BrianFaust\Friendable\HasFriends;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use HasFriends;
}$user->befriend($userToBeFriendsWith);$user->unfriend($userToBeFriendsWith);$user->denyFriendRequest($userToBeFriendsWith);$user->acceptFriendRequest($userToBeFriendsWith);$user->blockFriendRequest($userToBeFriendsWith);$user->unblockFriendRequest($userToBeFriendsWith);$user->hasBlocked($userToBeFriendsWith);$user->isBlockedBy($userToBeFriendsWith);$user->isFriendsWith($userToBeFriendsWith);$user->getFriendship($userToBeFriendsWith);$user->getAllFriendships();$user->getPendingFriendships();$user->getAcceptedFriendships();$user->getDeniedFriendships();$user->getBlockedFriendships();$user->getFriendRequests();$ phpunitIf you discover a security vulnerability within this package, please send an e-mail to Brian Faust at hello@brianfaust.me. All security vulnerabilities will be promptly addressed.