/**
  * Determine if current user follows another user.
  *
  * @param User $user
  * @return bool
  */
 public function isFollowedBy(User $user)
 {
     $idsOfUsersFollowed = $user->followedUsers()->lists('followed_id');
     return in_array($this->id, $idsOfUsersFollowed);
 }
 /**
  * Determine if current user follows another user.
  *
  * @param User $otherUser
  * @return bool
  */
 public function isFollowedBy(User $otherUser)
 {
     $idsWhoOtherUserFollows = $otherUser->followedUsers()->lists('followed_id');
     return $idsWhoOtherUserFollows->contains($this->id);
 }
Example #3
0
 /**
  * Determine if current user follows another user
  *
  * @param User $otherUser
  * @return bool
  */
 public function isFollowedBy(User $otherUser)
 {
     $idsWhoOtherUserFollows = $otherUser->followedUsers()->lists('followed_id');
     return in_array($this->id, $idsWhoOtherUserFollows);
 }
Example #4
0
 /**
  * Unfollow a Larabook user
  * @param $userIdToUnFollow
  * @param User $user
  * @return mixed
  */
 public function unfollow($userIdToUnFollow, User $user)
 {
     return $user->followedUsers()->detach($userIdToUnFollow);
 }
 /**
  * Unfollow a Larabook user.
  *
  * @param      $userToUnfollow
  * @param User $followingUser
  * @return int
  */
 public function unfollow($userToUnfollow, User $followingUser)
 {
     return $followingUser->followedUsers()->detach($userToUnfollow);
 }
 /**
  * @param $idUserToUnfollow
  * @param User $user
  */
 public function unfollow($idUserToUnfollow, User $user)
 {
     $user->followedUsers()->detach($idUserToUnfollow);
 }