Closed Autive closed 7 months ago
So while this is great, it is double work. We already have a votes
table that is polymorphic.
You can see that here: https://github.com/ploi/roadmap/blob/main/app/Traits/HasUpvote.php#L17
It's just a matter of applying the trait to your model (in this case Changelog.php) and using the available methods from that trait.
It saves another table creation, and everything else is already saved in that table automatically by calling the toggleUpvote()
method. (https://github.com/ploi/roadmap/blob/main/app/Traits/HasUpvote.php#L31)
Item.php model has this: https://github.com/ploi/roadmap/blob/main/app/Models/Item.php#L25 Comment.php model has this: https://github.com/ploi/roadmap/blob/main/app/Models/Comment.php#L15
Didn't notice that, Changed the PR to move this to the Upvote Trait.
🥰
This adds the ability to like/vote on changelogs as suggested in #205.