jeroenherczeg / dog
A User Follow Package for Laravel 5
Requires
- php: >=5.4
- laravel/framework: >= 5.1
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is auto-updated.
Last update: 2024-11-06 14:43:52 UTC
README
Add a user following system like Twitter, Quora or any other social network that allows you to follow another user and have users follow you.
Install
You can install the package via composer:
$ composer require jeroenherczeg/dog
Next, you must install the service provider:
// config/app.php 'providers' => [ ... Jeroenherczeg\Dog\FollowServiceProvider::class, ];
You can publish the migration with:
php artisan vendor:publish --provider="Jeroenherczeg\Dog\FollowServiceProvider"
After the migration has been published you can create the followers
table by running the migrations:
php artisan migrate
Add the followable trait to the User model
use Jeroenherczeg\Dog\Followable; class User extends Model { use Followable; ...
Usage
// Follow User $user->follow(1) $user->follow([1,2,3,4]) // Unfollow User $user->unfollow(1) $user->unfollow([1,2,3,4]) // Get Followers $user->followers() // Get Followings $user->followings() // Check if Follow $user->isFollowing(1) // Check if Followed By $user->isFollowedBy(1)
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email jeroen@herczeg.be instead of using the issue tracker.
Credits
- Jeroen Herczeg
- Initialy forked from Mohammed Isa
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Why Dog?
Your dog follows you because it's highly social - has a powerful emotional need for companionship - and knows that you are super-cool. You are the source of all good things in its life: food, walks, rides, treats, toys. Who knows what amazing thing will happen wherever you're going?