Skip to content

Commit

Permalink
Method name changes and update README.md (#16)
Browse files Browse the repository at this point in the history
* Update README.md

- fix typo deleteFriend
- add 'same user' to checkFriendship return values

* Method name changes and update README.md
  • Loading branch information
Ranie Santos authored and merodiro committed Dec 1, 2017
1 parent f0c8fc0 commit cdae801
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Friendable.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function friends()
->get();
}

public function friendRequestsTo()
public function friendRequestsReceived()
{
$senders = Friendship::whereRecipient($this)
->accepted(0)
Expand All @@ -95,7 +95,7 @@ public function friendRequestsTo()
->get();
}

public function friendRequestsFrom()
public function friendRequestsSent()
{
$recipients = Friendship::whereSender($this)
->accepted(0)
Expand All @@ -106,7 +106,7 @@ public function friendRequestsFrom()
->get();
}

public function isFriendWith($user)
public function isFriendsWith($user)
{
$friendshipStatus = $this->checkFriendship($user);

Expand Down

0 comments on commit cdae801

Please sign in to comment.