PHP code example of shababsoftwares / laravel-friendships
1. Go to this page and download the library: Download shababsoftwares/laravel-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/ */
shababsoftwares / laravel-friendships example snippets
use ShababSoftwares\Friendships\Traits\Friendable;
class User extends Model
{
use Friendable;
...
}
// Methods usages (Status available: pending, denied, blocked and accepted.) (Paginators available: none, default, simple)
$user->{status}Friends($resultsPerPage = 0, $paginationType = 'none');
// Example #1: (Get accepted friends using default paginator with 25 results per page).
$user->acceptedFriends(25, 'default');
// Example #2: (Get pending friends using simple paginator with 10 results per page).
$user->pendingFriends(10, 'simple');
// Example #3: (Get all denied friends without pagination).
$user->deniedFriends();
// Example #3: (Get denied friends using default paginator with 30 results per page).
$user->blockedFriends(30);