PHP code example of skybluesofa / laravel-followers
1. Go to this page and download the library: Download skybluesofa/laravel-followers 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/ */
use Skybluesofa\Followers\Traits\Followable;
class User extends Model
{
use Followable;
...
}
$user->follow($recipient);
$recipient->acceptFollowRequestFrom($user);
$recipient->denyFollowRequestFrom($user);
$user->unfollow($recipient);
$user->blockBeingFollowedBy($recipient);
$user->unblockBeingFollowedBy($recipient);
$user->isFollowing($recipient);
$recipient->isFollowedBy($user);
$recipient->hasFollowRequestFrom($user);
$user->hasSentFollowRequestTo($recipient);
$recipient->hasBlockedBeingFollowedBy($user);
$user->isBlockedFromFollowing($recipient);
$user->getFriendship($recipient);
$user->getAllFriendships();
$user->getPendingFriendships();
$user->getAcceptedFriendships();
$user->getDeniedFriendships();
$user->getBlockedFriendships();
$user->getFriendRequests();
$user->getFriendsCount();
$user->getFriends();
$user->getFriends($perPage = 20);
Skybluesofa\LaravelFollowers\Events\FollowingBlocked(Model $recipient, Model $sender);
Skybluesofa\LaravelFollowers\Events\FollowingUnblocked(Model $recipient, Model $sender);
Skybluesofa\LaravelFollowers\Events\FollowRequest(Model $recipient, Model $sender);
Skybluesofa\LaravelFollowers\Events\FollowRequestAccepted(Model $recipient, Model $sender);
Skybluesofa\LaravelFollowers\Events\FollowRequestDenied(Model $recipient, Model $sender);
Skybluesofa\LaravelFollowers\Events\Unfollow(Model $recipient, Model $sender);