francescomalatesta / laravel-reactions

Implement reactions for your Eloquent models, easily.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check if entity is reacted by given user

piterjov opened this issue · comments

commented
public function isReactedBy($responder = null)
{
    if (is_null($responder)) {
        $responder = auth()->user();
    }

    return $this->reactions()
        ->where('responder_id', $responder->id)
        ->where('responder_type', get_class($responder))->exists();

}