Skip to content

Commit

Permalink
Merge pull request #7 from jcc/master
Browse files Browse the repository at this point in the history
🐛 Fix relation bug.
  • Loading branch information
overtrue authored May 15, 2017
2 parents 88c9447 + bf40779 commit 643b417
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Traits/CanBeLiked.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function isLikedBy($user)
*/
public function likers()
{
return $this->morphMany(config('follow.user_model'), config('follow.morph_prefix'), config('follow.followable_table'))
return $this->morphToMany(config('follow.user_model'), config('follow.morph_prefix'), config('follow.followable_table'))
->wherePivot('relation', '=', Follow::RELATION_LIKE)
->withPivot('followable_type', 'relation', 'created_at');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/CanBeSubscribed.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function isSubscribedBy($user)
*/
public function subscribers()
{
return $this->morphMany(config('follow.user_model'), config('follow.morph_prefix'), config('follow.followable_table'))
return $this->morphToMany(config('follow.user_model'), config('follow.morph_prefix'), config('follow.followable_table'))
->wherePivot('relation', '=', Follow::RELATION_SUBSCRIBE)
->withPivot('followable_type', 'relation', 'created_at');
}
Expand Down

0 comments on commit 643b417

Please sign in to comment.