From cdae8014a6c678bc1123cba214cfc55834ab43a9 Mon Sep 17 00:00:00 2001 From: Ranie Santos Date: Fri, 1 Dec 2017 16:36:18 +0800 Subject: [PATCH] Method name changes and update README.md (#16) * Update README.md - fix typo deleteFriend - add 'same user' to checkFriendship return values * Method name changes and update README.md --- README.md | 17 +++++++++-------- src/Friendable.php | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d4810aa..0648f60 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,12 @@ $user->acceptFriend($sender); #### Deny a Friend Request ```php -$user->delteFriend($sender); +$user->deleteFriend($sender); ``` #### Remove Friend ```php -$user->delteFriend($friend); +$user->deleteFriend($friend); ``` #### check the current relation between two users @@ -73,14 +73,15 @@ $user->checkFriendship($anotherUser); ``` it returns +* `same user` => if the user you are checking against is yourself * `friends` => if they are friends * `waiting` => if the first user sent request to the second * `pending` => if the second user sent request to the first * `not friends` => if they are not friends and no friend requests -#### Check if user is friend with +#### Check if two users are friends ```php -$user->isFriendWith($anotherUser); +$user->isFriendsWith($anotherUser); ``` it returns `true` if they are friends and `false` if they aren't friends @@ -92,14 +93,14 @@ To get a collection of users use the following methods: $user->friends(); ``` -#### Get a list of users who sent friend request to `$user` +#### Get a list of users that `$user` has received friend requests from ```php -$user->friendRequestsTo(); +$user->friendRequestsReceived(); ``` -#### Get a list of users who have friend requests from `$user` +#### Get a list of users that `$user` has sent friend requests to ```php -$user->friendRequestsFrom(); +$user->friendRequestsSent(); ``` ## Events diff --git a/src/Friendable.php b/src/Friendable.php index a227ed5..aea60c8 100644 --- a/src/Friendable.php +++ b/src/Friendable.php @@ -84,7 +84,7 @@ public function friends() ->get(); } - public function friendRequestsTo() + public function friendRequestsReceived() { $senders = Friendship::whereRecipient($this) ->accepted(0) @@ -95,7 +95,7 @@ public function friendRequestsTo() ->get(); } - public function friendRequestsFrom() + public function friendRequestsSent() { $recipients = Friendship::whereSender($this) ->accepted(0) @@ -106,7 +106,7 @@ public function friendRequestsFrom() ->get(); } - public function isFriendWith($user) + public function isFriendsWith($user) { $friendshipStatus = $this->checkFriendship($user);