Require this package, with Composer, in the root directory of your project.
$ composer require artisanry/friendable
To get started, you'll need to publish the vendor assets and migrate:
php artisan vendor:publish --provider="Artisanry\Friendable\FriendableServiceProvider" && php artisan migrate
<?php
namespace App;
use Artisanry\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();
$ phpunit
If you discover a security vulnerability within this package, please send an e-mail to hello@basecode.sh. All security vulnerabilities will be promptly addressed.
This project exists thanks to all the people who contribute.
Mozilla Public License Version 2.0 (MPL-2.0).