Friendable Polymorphic Eloquent Models for Laravel 5

3.1.1 2019-06-29 09:47 UTC


Build Status PHP from Packagist Latest Version License


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


Setup a Model


namespace App;

use Artisanry\Friendable\HasFriends;
use Illuminate\Database\Eloquent\Model;

class User extends Model
    use HasFriends;


Send a Friend-Request to a Model


Unfriend a Model


Deny a Friend-Request from a Model


Accept a Friend-Request from a Model


Block a Model


Unblock a Model


Check if the Model has blocked another Model


Check if one Model is blocked by another Model


Check if a Friendship exists between two models


Get a single friendship


Get a list of all Friendships


Get a list of pending Friendships


Get a list of accepted Friendships


Get a list of denied Friendships


Get a list of blocked Friendships


Get a list of pending Friend-Requests



$ phpunit


If you discover a security vulnerability within this package, please send an e-mail to 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).