1. Go to this page and download the library: Download ghanem/friendship 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/ */
ghanem / friendship example snippets
use Ghanem\Friendship\Contracts\Friendable as FriendableContract;
use Ghanem\Friendship\Traits\Friendable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements FriendableContract
{
use Friendable;
}
$me->befriend($you); // send a request (returns ?Friendship)
$you->acceptFriendRequest($me); // only the recipient can accept
$you->denyFriendRequest($me); // deny — $me may send a new request later
$me->unfriend($you); // remove an accepted friendship
$me->block($you); // works with or without a prior friendship
$me->unblock($you); // only the blocker can unblock