ashmawi / laravel-follow
User follow unfollow system for Laravel.
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ashmawi/laravel-follow
This package is not auto-updated.
Last update: 2026-01-05 17:32:57 UTC
README
Installing
$ composer require ashmawi/laravel-follow
$ php artisan migrate
Configuration
This step is optional
$ php artisan vendor:publish --tag=laravel-follow-config
Migrations
This step is also optional, if you want to custom the pivot table, you can publish the migration files
$ php artisan vendor:publish --tag=laravel-follow-migrations
Usage
Traits
use Ashmawi\LaravelFollow\Traits\Followable; class User extends Authenticatable { use Followable; }
API
$user1->follow($user2); $user1->unfollow($user2); $user1->isFollowing($user2)
Get followings
$user->followings
Get followers
$user->followers
Aggregations
// followings count $user->followings()->count(); // with query where $user->followings()->where('x', 'x')->count(); // followers count $user->followers()->count();