Skip to content

Get reactions of the Reacterable model on concrete Reactable model #239

Discussion options

You must be logged in to vote

Solution №1

Add new method to the ReactantFacade.

public function getReactionsBy(
    Reacterable $reacterable,
): iterable;
// Get all reactions the post received (already existing method)
$allReactionsOnPost = $post->viaLoveReactant()->getReactions();

// Get reactions the post received from the user
$userReactionsOnPost = $post->viaLoveReactant()->getReactionsBy($user);

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@antonkomarev
Comment options

Answer selected by antonkomarev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant