1. Go to this page and download the library: Download timgavin/laravel-follow 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/ */
timgavin / laravel-follow example snippets
namespace App\Models;
use TimGavin\LaravelFollow\LaravelFollow;
class User extends Authenticatable
{
use LaravelFollow;
}
auth()->user()->follow($user);
auth()->user()->unfollow($user);
@if (auth()->user()->isFollowing($user))
You are following this user.
@endif
@if (auth()->user()->isFollowedBy($user))
This user is following you.
@endif
auth()->user()->getFollowing();
auth()->user()->getFollowers();
// default limit is 5
auth()->user()->getLatestFollowers($limit);