- How do I install modularavel/likeable in a Laravel application?
- Install it with composer require modularavel/likeable, then publish and run any migration or config files the package provides. Add the package's likeable trait to the Eloquent models that should receive likes or dislikes. Because the v1.0.0 release note has no changelog body, confirm the exact vendor:publish tags and trait name in the repository README before wiring it into an existing app.
- Which Laravel and PHP versions does modularavel/likeable support?
- The supplied v1.0.0 release information does not state exact illuminate/* or PHP constraints. Check composer.json for the supported Laravel majors and minimum PHP version, and run the suite against your current and next Laravel LTS. Treat compatibility as unverified until the package's test matrix confirms MySQL, PostgreSQL, and SQLite behavior.
- How do I add like and dislike buttons to a Laravel model with modularavel/likeable?
- The expected pattern is to attach the package's trait to a model such as Post or Comment and use its relationship and helper methods for likes and dislikes. A Livewire component is also part of the stated purpose, so check the README for the component name and required properties or events. Verify the actual method names, since the empty changelog means the public API is not documented in the release note.
- Does modularavel/likeable use a polymorphic relationship for likes?
- It is designed around the standard Laravel polymorphic likes pattern, with a likes table containing likeable_type, likeable_id, and user_id. That lets one trait cover posts, comments, and other resources without separate tables. Polymorphic relations cannot carry a real foreign key to the parent, so orphan cleanup after parent deletion remains an application concern.
- How does modularavel/likeable prevent duplicate likes?
- A robust implementation needs a unique composite index on user_id, likeable_type, and likeable_id, plus firstOrCreate or a handled unique-constraint exception when toggling. The package is expected to ship that migration, but the release note does not confirm it, so inspect the migration before relying on it. Without the index, concurrent requests can create duplicate rows and skew counts.
- Does modularavel/likeable provide like counts or a counter cache?
- Expect relationship helpers and query-level counts, and possibly a likesCount helper, but do not assume a counter cache is included. If a cached count column exists, confirm the update is transactional and idempotent under toggles and retries. Otherwise use withCount or a cached query until you can add a safe counter strategy.
- Can I use modularavel/likeable with UUID keys or multi-tenant applications?
- This is a key unknown: verify whether the migration uses morphs() or uuidMorphs() and whether config lets you set the table name, morph key type, and user model. Without that configuration, UUID-keyed or multi-tenant apps may need a fork or a custom migration. Check these before adoption if your models do not use integer primary keys.
- Is modularavel/likeable production-ready, actively maintained, and what alternatives exist?
- The 1.0.0 tag is the first release and its changelog body is empty, so stability is signaled by semver but not explained. It is a single-maintainer package, so review the compare link, test suite, CI matrix, issue responsiveness, license, and security policy before production use. If you need proven longevity, compare it with a custom polymorphic likes table or a more established reactions package.
- How should I test like and dislike behavior with modularavel/likeable?
- Use RefreshDatabase and model factories, then assert that a like creates the expected row and that a second identical like does not duplicate it. Test the unique constraint, toggle idempotency, count accuracy, and authorization rules at the application layer. For the Livewire component, use Livewire::test to cover rendered state and events, and review the package's own CI matrix for supported databases.
- Does modularavel/likeable handle authorization and orphaned likes?
- No built-in authorization is expected; who may like which resource should be enforced with Laravel policies or gates in your app. Orphaned like rows are a typical polymorphic hazard, so add cleanup on parent deletion or a scheduled prune for soft-deleted models. Confirm whether the package offers any cascade or soft-delete helpers before building your own.