Download the PHP package gorankrgovic/laravel-likeable without Composer
On this page you can find all versions of the php package gorankrgovic/laravel-likeable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gorankrgovic/laravel-likeable
More information about gorankrgovic/laravel-likeable
Files in gorankrgovic/laravel-likeable
Package laravel-likeable
Short Description Make Laravel Eloquent models Likeable using UUIDs.
License MIT
Homepage https://github.com/gorankrgovic/laravel-likeable
Informations about the package laravel-likeable
Laravel Likeable
Introduction
This package is basically a simplified fork of a Laravel Love package with only using LIKE and UNLIKE capability. "Laravel Love" have more capabilities such as both "LIKE" and "DISLIKE" functionality.
Also, worth noting that this package utilizes usage of UUID's instead of integer ID's. And the "Likeable" and "Liker" models needs to utilize UUIDs as well. If you are not using UUID's please use the cybercog/laravel-likeable, cybercog/laravel-love or any of the alternatives listed below.
For the UUID generation this package uses Ramsey UUID.
Features
- Uses UUIDs instead of integers (your user model must use them as well!)
- Designed to work with Laravel Eloquent models.
- Using contracts to keep high customization capabilities.
- Using traits to get functionality out of the box.
- Most part of the the logic is handled by the
LikeableService
. - Has Artisan command
golike:recount {model?}
to re-fetch like counters. - Subscribes for one model are mutually exclusive.
- Get Likeable models ordered by likes count.
- Events for
like
,unlike
methods. - Following PHP Standard Recommendations:
Alternatives
- cybercog/laravel-love
- cybercog/laravel-likeable
- rtconner/laravel-likeable
- faustbrian/laravel-likeable
- sukohi/evaluation
- zvermafia/lavoter
- francescomalatesta/laravel-reactions
- muratbsts/laravel-reactable
Installation
First, pull in the package through Composer.
Perform Database Migration
At last you need to publish and run database migrations.
If you want to make changes in migrations, publish them to your application first.
Usage
Prepare Liker Model
Use Gox\Contracts\Likeble\Liker\Models\Liker
contract in model which will get likes
behavior and implement it or just use Gox\Laravel\Likeable\Liker\Models\Traits\Liker
trait.
Prepare Likeable Model
Use Gox\Contracts\Likeable\Likeable\Models\Likeable
contract in model which will get likes
behavior and implement it or just use Gox\Laravel\Likeable\Likeable\Models\Traits\Likeable
trait.
Available Methods
Likes
Like model
Remove like mark from model
Get model likes count
Get model likes counter
Get likes relation
Get iterable Illuminate\Database\Eloquent\Collection
of existing model likes
Boolean check if user likes model
Checks in eager loaded relations likes
first.
Get collection of users who likes model
Delete all likers for model
Scopes
Find all articles liked by user
Fetch Likeable models by likes count
Uses desc
as default order direction.
Events
On each like added \Gox\Laravel\Subscribe\Subscribeable\Events\LikeableWasLiked
event is fired.
On each like removed \Gox\Laravel\Subscribe\Subscribeable\Events\LikeableWasUnliked
event is fired.
Console Commands
Recount likes of all model types
Recount of concrete model type (using morph map alias)
Recount of concrete model type (using fully qualified class name)
Security
If you discover any security related issues, please email me instead of using the issue tracker.
License
Laravel Likeable
package is open-sourced software licensed under the MIT license by Goran Krgovic.Laravel Love
package is open-sourced software licensed under the MIT license by Anton Komarev.
All versions of laravel-likeable with dependencies
illuminate/database Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
illuminate/support Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0
ramsey/uuid Version ^3.8