User like feature for laravel application.
- https://github.com/overtrue/laravel-like
- https://github.com/overtrue/laravel-follow
- https://github.com/hypefactors/laravel-follow
- PHP >= 7.3
- Laravel >= ^6.0
$ composer require sebastian-kennedy/laravel-like -vvv
$ php artisan vendor:publish --provider="SebastianKennedy\\LaravelLike\\LikeServiceProvider" --tag=config
$ php artisan vendor:publish --provider="SebastianKennedy\\LaravelLike\\LikeServiceProvider" --tag=migrations
<?php
namespace SebastianKennedy\LaravelLike\Tests\Models;
use Illuminate\Database\Eloquent\Model;
use SebastianKennedy\LaravelLike\Behaviors\CanBeLikedBehavior;
class Book extends Model
{
use CanBeLikedBehavior;
protected $fillable = ['title'];
}
<?php
namespace SebastianKennedy\LaravelLike\Tests\Models;
use Illuminate\Database\Eloquent\Model;
use SebastianKennedy\LaravelLike\Behaviors\CanLikeBehavior;
class User extends Model
{
use CanLikeBehavior;
protected $fillable = ['name'];
}
<?php
$user = User::first();
$book = Book::first();
$user-like($book);
$user->unlike($book);
$user->toggleLike($book);
$user->hasLiked($book);
$user->likes();
$book->isLikedBy($user);
$book->likes();
$book->likers();
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-12 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
MIT