| Package Data | |
|---|---|
| Maintainer Username: | ghanem |
| Maintainer Contact: | 3bdullah.ghanem@gmail.com (abdullah ghanem) |
| Package Create Date: | 2015-10-23 |
| Package Last Update: | 2015-11-25 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-23 03:02:56 |
| Package Statistics | |
|---|---|
| Total Downloads: | 136 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 18 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 2 |
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();