PHP code example of merodiro / friendships

1. Go to this page and download the library: Download merodiro/friendships library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

merodiro / friendships example snippets


composer 

'providers' => [
    ...
    Merodiro\Friendships\FriendshipsServiceProvider::class,
    ...
];

use Merodiro\Friendships\Friendable;
class User extends Model
{
    use Friendable;
    ...
}

$user->addFriend($recipient);

$user->acceptFriend($sender);

$user->deleteFriend($sender);

$user->deleteFriend($friend);

$user->mutualFriends($anotherUser);

$user->checkFriendship($anotherUser);

$user->isFriendsWith($anotherUser);

$user->friends();

$user->friendRequestsReceived();

$user->friendRequestsSent();

php artisan migrate