Add facade method to see all of the reactions between a specific reactant/reactor pair #173
Replies: 7 comments
-
@cheryllium thanks for suggestion! I'll need some time to think about it more. You could implement it in your own application, but I'll think about adding it into the core. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply (and thank you for your work on this awesome library) In case it helps someone else, the workaround I used in my application was to retrieve all reaction types ( |
Beta Was this translation helpful? Give feedback.
-
It's a much needed feature. I spent almost 2-3 hours to figure out the way of getting the reaction type name (like/love) for a specific reactant (post/comment) by a specific reacter (user/team). (Adding a terminology section in the doc would be nice). Ended up @cheryllium 's way. I was also thinking about passing a parameter in $reactantFacade->getReactions(/here/) for eg: auth()->user(). Obviously the package has created with flexibility & advance reaction system keeping in mind but at the same time it added complexities. The reason is that the documentation is not clear enough. It's an incomplete API documentation only. A User Guide is badly needed too. It's taking hours to figure out what's happening with dump & dd. There are so many things not clear to me. Reading through the docs from the page: https://laravel-love.readme.io/docs/reaction , it seems like we have a nice api of Reactions, but where should I start? How do I get the reaction facade to get the reaction info (eg: name)? Hope it will have a User Guide as well & just not an API documentation. But thanks for the package. |
Beta Was this translation helpful? Give feedback.
-
@farhanianz it is preferably to use facades:
$user->viaLoveReacter()->reactTo($comment, 'Like'); |
Beta Was this translation helpful? Give feedback.
-
You are right. This package requires Quick Start guide. Don't have enough free time to write it. Any help will be appreciated, it could be pushed to the docs by any user. Related issue #101 |
Beta Was this translation helpful? Give feedback.
-
How am I supposed to get the reaction type name of a reacter of a given reactant? I think it's not possible yet (w/o workaround), that's why the issue raised here. How about having something like: So if a user already liked/loved a post, I can display what reaction the user just given to the reactant. Maybe I'll give a try writing a quickstart guide once I grasp it clearly. Not sure about it though 😒. |
Beta Was this translation helpful? Give feedback.
-
@farhanianz here is repo where I tested upgrading between major versions: https://github.com/antonkomarev/laravel-love-upgrade |
Beta Was this translation helpful? Give feedback.
-
For example, let's say I have reactable Comments, and reacterable Users. For a specific comment, I want to know all of the ways a specific User has reacted to it. For example, if a User reacted to a comment with a Like, a Haha, AND a Party reaction, it would be great if there was a way to get an iterable of those three Reactions.
An example of where this functionality could be practical would be an application where comments can have multiple reactions from multiple people, and the ones you've already selected are highlighted in some way. Discord and Slack are popular software that do this with their UX.
I think this enhancement would make most sense as an edit to
getReactions()
in the Reactant facade.laravel-love/src/Reactant/Facades/Reactant.php
Line 39 in c037dde
This method could be modified to take a Reacter as an optional parameter. When the parameter is given, it would return an iterable of its Reactions but filtered to only the ones from that Reacter.
Alternatively, it could be implemented in the Reacter facade as part of
getReactions()
there - I'm not sure if that is better than putting it in the other facade, or if possibly it should be in both if this enhancement were approved.Beta Was this translation helpful? Give feedback.
All reactions