cjmellor/engageify
Engageify is a Laravel package that adds engagement features to Eloquent models. Use simple traits to let users like, bookmark, rate, subscribe to, and follow resources, with polymorphic relationships and query scopes included.
composer require cjmellor/engageify
php artsan vendor:publish --tag="engageify-migrations"
(Correct command: php artisan vendor:publish --tag="engageify-migrations", then php artisan migrate.)
engagement_counters table at all — the auto-generated unique index name overflowed MySQL's 64-character identifier limit. There is nothing to evaluate on 2.0.0–2.1.1; skip straight to 2.1.2.type column holds enum values, so your enum is effectively your schema.Post, define an enum with cases like Like, Bookmark, Share, record an engagement from a controller, and read the counter for display. That end-to-end loop exercises both tables and the morph relation, which is 90% of what you will ever do with this package.php artisan migrate:fresh against MySQL, not just SQLite. The package's own CI runs on SQLite only, so MySQL is the environment where surprises live.engagements is the fact table (who engaged with what, when); engagement_counters is the denormalised aggregate (how many, keyed by engagementable + type). Read counters for listings and badges; query engagements for "has this user already liked this" and for toggling.engagement_counters is user-scoped. Don't try to repurpose it for per-user state.Relation::enforceMorphMap() in a service provider before you write any engagement rows. The morph alias lands in the unique index on engagement_counters; changing it afterwards is a data migration, not a config change.pin_engagement_type_collation migration that converts type in place on both tables and is a no-op on every non-MySQL/MariaDB driver. No counter rebuild is required — no v2 release could have been installed on MySQL, so no counters can be collapsed.type is now utf8mb4_bin on MySQL/MariaDB — it is case-sensitive. Everything inside Engageify already writes verbatim enum values, so application behaviour is unchanged. But a raw query, report, or admin tool that filters engagements.type = 'like' when the enum case is LIKE will silently return nothing. Audit any hand-written SQL against these columns.utf8mb4_unicode_ci assigns most emoji the same sort weight, so the unique index treated an entire emoji set as a single value — one counter row for all of them. If you have any home-grown aggregate table with a default collation and an emoji-ish key, you have the same latent bug.SHOW CREATE TABLE engagement_counters; should show utf8mb4_bin on type. If it shows utf8mb4_unicode_ci, the pin_engagement_type_collation migration did not run.vendor:publish --tag="engageify-migrations" again. Diff the published directory before committing — if you had local edits to the original migrations, they will be clobbered.engagements.How can I help you explore Laravel packages today?