morphTo for polymorphic reactions). This avoids reinventing core database interactions and integrates seamlessly with Laravel’s query builder.ReactionCreated) for extensibility without tight coupling. Existing models require minimal changes (e.g., adding HasReactions trait).reactions table with reactionable_id/type). Custom migrations may be needed for complex schemas.reactionable_id/type) could impact query performance if not optimized (e.g., indexing, eager loading).reaction:count cache tags).POST /reactions for reactions on resources).Post, Comment).likes tables).composer require binafy/laravel-reactions
php artisan vendor:publish --provider="Binafy\Reactions\ReactionsServiceProvider"
php artisan migrate.HasReactions trait to target models:
use Binafy\Reactions\Traits\HasReactions;
class Post extends Model { use HasReactions; }
['like', 'love', 'laugh']).@reaction directive or custom JS).ReactionValidator for custom rules).user_id to reactions table).telescope or laravel-debugbar to trace reaction queries/events.reactionable_id, type, and user_id for performance.reactions table for large-scale models.reaction:count:Post:123).ReactionCreated event) to avoid UI delays.reactionable_type) may break polymorphic relations.throttle middleware).DB::enableQueryLog().How can I help you explore Laravel packages today?