One thread · three frontends
The same comments. Three stacks.
Polymorphic relations are underrated is a single Eloquent record. Livewire, React, and Vue all render
the same thread UI. This public demo mounts
<livewire:comments />
for every tab. React and Vue components ship with Commentify and match this markup.
Discussion (5)
Or Log in to comment!
The point about losing foreign keys is the one that always comes up in review, and I think it gets overweighted. In five years I have never had an orphaned comment row cause a production incident. I have had three separate
*_commentstables drift out of sync on features.Moderator note: the comment that used to sit here with two scam URLs was denied by the heuristic checker. That is the spam pipeline, not a person at 2am.
Shipped this pattern on my side project last month. The bit I underestimated was moderation — one table means one queue, which turned out to be the actual win.
Reading this as someone six weeks into Laravel — is there a downside to just using this pattern for everything user-generated? Attachments, ratings, reactions?
One thing I would add to the "where it bites" section: sorting.
most_repliedneeds awithCount, and if you are also filtering by approval status the counts have to respect that filter or your numbers lie. Took me an embarrassingly long afternoon to work that out.