This package is abandoned and no longer maintained. The author suggests using the artisanry/likeable package instead.

Likeable Polymorphic Eloquent Models for Laravel 5

3.2.0 2019-08-28 13:03 UTC

This package is auto-updated.

Last update: 2019-08-28 13:22:59 UTC


Build Status PHP from Packagist Latest Version License


Require this package, with Composer, in the root directory of your project.

$ composer require artisanry/likeable

To get started, you'll need to publish the vendor assets and migrate:

php artisan vendor:publish --provider="Artisanry\Likeable\LikeableServiceProvider" && php artisan migrate


Setup a Model


namespace App;

use Artisanry\Likeable\HasLikesTrait;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
    use HasLikesTrait;

Post Model gets liked by User Model


Post Model gets disliked by User Model


Count all likes


Collection of all likes


Check if the Post Model is currently liked by the User Model


Load posts that are currently liked by the User Model


Count likes the Post Model has


Count likes the Post Model has for a specific date


Count likes the Post Model has between two dates

$post->getLikeCountByDate('2015-06-30', '2015-06-31');


$ phpunit


If you discover a security vulnerability within this package, please send an e-mail to hello@basecode.sh. All security vulnerabilities will be promptly addressed.


This project exists thanks to all the people who contribute.


Mozilla Public License Version 2.0 (MPL-2.0).