Download the PHP package jobmetric/laravel-like without Composer
On this page you can find all versions of the php package jobmetric/laravel-like. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jobmetric/laravel-like
More information about jobmetric/laravel-like
Files in jobmetric/laravel-like
Package laravel-like
Short Description This is a reaction management package for Laravel that you can use in your projects.
License MIT
Homepage https://doc.jobmetric.net/package/laravel-reaction
Informations about the package laravel-like
Laravel Reaction
A modern, flexible, and test-covered Laravel package that allows your models to handle reaction functionality (like, dislike, love, etc.). This package provides a clean API for both reactable (e.g., articles, posts) and reactor (e.g., users, devices) models.
๐พ Installation
Install via composer:
Then publish and run the migration:
โจ Usage
Step 1: Add HasReaction
to your model (e.g., Article
)
Step 2: Add CanReact
to your reactor model (e.g., User
)
โ Main Features
โ Add Reaction
๐ Toggle Reaction
โ Remove Reaction
โโ Remove All Reactions (by user or device)
โป๏ธ Update Reaction
โป๏ธ Restore Deleted Reaction
๐ Counting and Summary
Total Reactions
Count by Type
Reaction Summary
๐ Querying
Has Reaction?
Get Latest Reactions
Get Specific Reaction
๐ง Reactor Functions (for User or any model using CanReact)
Check if Reacted
Check Specific Reaction
Get Summary of User Reactions
Get All Reacted Items
Latest Reactions Given
๐งฑ Reaction Model Columns
Field | Description |
---|---|
reactor_type | Polymorphic class of reactor (e.g., User) |
reactor_id | ID of the reactor |
reactable_type | Polymorphic class of reactable (e.g., Post) |
reactable_id | ID of the reactable |
reaction | Reaction type (e.g., like, love, etc.) |
ip | IP address of reaction |
device_id | Optional device identifier |
source | Source (e.g., web, app, api) |
๐งช Events
Event | Triggered When |
---|---|
ReactionAddEvent | A new reaction is added |
ReactionRemovingEvent | Before a reaction is removed |
ReactionRemovedEvent | After a reaction is removed |
๐งผ Pruning Reactions
This package uses SoftDeletes and supports automatic pruning:
You can configure the number of days in your config:
๐ค Contributing
Thank you for considering contributing to the Laravel Reaction! The contribution guide can be found in the CONTRIBUTING.md.
๐ License
This package is open-sourced under the MIT license.
All versions of laravel-like with dependencies
laravel/framework Version >=9.19
jobmetric/laravel-package-core Version ^1.20