Downloads
Stars
Version
This package will allow you to add a full report system into your Laravel application.
First, pull in the package through Composer.
composer require ghanem/friendship
And then include the service provider within app/config/app.php
.
'providers' => [
Ghanem\Friendship\FriendshipServiceProvider::class
];
At last you need to publish
php artisan vendor:publish --provider="Ghanem\Friendship\FriendshipServiceProvider"
and run the migration.
php artisan migrate
<?php
namespace App;
use Ghanem\Friendship\Contracts\Friendable;
use Ghanem\Friendship\Traits\Friendable as FriendableTrait;
use Illuminate\Database\Eloquent\Model;
class User extends Model implements Friendable
{
use FriendableTrait;
}
$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();