dev-master
9999999-devThis package gives Eloqent models the ability to manage their friendships.
MIT
The Requires
- php >=5.4.0
The Development Requires
by Interfriendz
laravel friends friendships friend-system eloqent
Wallogit.com
2017 © Pedro Peláez
This package gives Eloqent models the ability to manage their friendships.
This package gives Eloqent models the ability to manage their friendships. You can easily design a Facebook like Friend System., (*1)
First, install the package through Composer., (*2)
composer require hootlex/laravel-friendships
Then include the service provider inside config/app.php., (*3)
'providers' => [
...
Hootlex\Friendships\FriendshipsServiceProvider::class,
...
];
Lastly you need to publish the migration and migrate the database, (*4)
php artisan vendor:publish --provider="Hootlex\Friendships\FriendshipsServiceProvider" && php artisan migrate
use Hootlex\Friendships\Traits\Friendable;
class User extends Model
{
use Friendable;
...
}
Check the Test file to see the package in action, (*5)
$user->befriend($recipient);
$user->acceptFriendRequest($recipient);
$user->denyFriendRequest($recipient);
$user->unfriend($recipient);
$user->blockFriend($recipient);
$user->unblockFriend($recipient);
$user->isFriendWith($recipient);
$user->hasFriendRequestFrom($recipient);
$user->hasBlocked($recipient);
$user->isBlockedBy($recipient);
$user->getFriendship($recipient);
$user->getAllFriendships();
$user->getPendingFriendships();
$user->getAcceptedFriendships();
$user->getDeniedFriendships();
$user->getBlockedFriendships();
$user->getFriendRequests();
$user->getFriendsCount();
$user->getFriends();
$user->getFriends($perPage = 20);
$user->getFriendsOfFriends($perPage = 20);
This package gives Eloqent models the ability to manage their friendships.
MIT
laravel friends friendships friend-system eloqent