PHP code example of arubacao / friends

1. Go to this page and download the library: Download arubacao/friends 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/ */

    

arubacao / friends example snippets


'providers' => [
    ...
    Arubacao\Friends\FriendsServiceProvider::class,
    ...
];


use Arubacao\Friends\Traits\Friendable;

class User extends Model
{
    use Friendable; // Add this trait to your model
    ...
}

$user->sendFriendRequestTo($recipient);

$user->acceptFriendRequestFrom($sender);

$user->denyFriendRequestFrom($sender);

$user->deleteFriend($douchebag);

$friends = $user->friends();

$friends = $user->incoming_friends();

$friends = $user->any_friends();

$user->hasRelationshipWith($person, $status);

$user->getRelationshipWith($person, $status);

$user->hasPendingRequestFrom($person);

$users = \App\User::whereIn('id', [2,3,4])
      ->
bash
php artisan vendor:publish --provider="Arubacao\Friends\FriendsServiceProvider"
php artisan migrate