Skip to content

Commit

Permalink
Merge pull request #14 from Livijn/patch-1
Browse files Browse the repository at this point in the history
Update CanLike.php
  • Loading branch information
overtrue authored Mar 4, 2020
2 parents ac3b5c0 + 6168365 commit 4ae55dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Traits/CanLike.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function toggleLike(Model $object)
*/
public function hasLiked(Model $object)
{
return tap($this->relationLoaded('likes') ? $this->likes : $this->likes())
return ($this->relationLoaded('likes') ? $this->likes : $this->likes())
->where('likable_id', $object->getKey())
->where('likable_type', $object->getMorphClass())
->count() > 0;
Expand Down

0 comments on commit 4ae55dc

Please sign in to comment.