Method Illuminate\Database\Eloquent\Collection::viaLoveReactant does not exist.
bertux77 opened this issue · comments
Hello everyone,
I am trying to implement this package, which I must say is costing me quite a lot as I haven't seen any tutorial explaining it. So I take this opportunity to suggest that you post a tutorial or at least a working demo on Github that we can download for testing.
That said, I would like to see why I get this error, I'm trying to return the total likes but I get this error:
BadMethodCallException
Method Illuminate\Database\Eloquent\Collection::viaLoveReactant does not exist.
The code with which I am trying to access the total is:
$comment = Comment::where('id', "232")->get(); // return comment
return $comment->viaLoveReactant()->getReactionCounters();
Method get
returns collection of comments, not an actual comment.
$comment = Comment::where('id', "232")->firstOrFail();
return $comment->viaLoveReactant()->getReactionCounters();