Download the PHP package merodiro/friendships without Composer
On this page you can find all versions of the php package merodiro/friendships. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download merodiro/friendships
More information about merodiro/friendships
Files in merodiro/friendships
Package friendships
Short Description This package gives users the ability to manage their friendships.
License MIT
Informations about the package friendships
Laravel 5 Friendships
This package gives users the ability to manage their friendships.
Models can:
- Send Friend Requests
- Accept Friend Requests
- Deny Friend Requests
- Delete Friend
Installation
First, install the package through Composer.
Then include the service provider inside config/app.php
.
Finally, migrate the database
Setup a Model
How to use
Check the Test file to see the package in action
Send a Friend Request
Accept a Friend Request
Deny a Friend Request
Remove Friend
Mutual Friends
check the current relationship between two users
it returns
same_user
=> if the$user
is checking his own accountfriends
=> if they are friendswaiting
=> if$user
sent a request waiting for approval from$anotherUser
pending
=> if$anotherUser
user sent a request waiting for approval from$user
not_friends
=> if they are not friends
Check if two users are friends
it returns true
if they are friends and false
if they aren't
Friends
To get a collection of users use the following methods:
Get Friends
Get a list of users that $user
has received friend requests from
Get a list of users that $user
has sent friend requests to
Events
This is the list of the events fired by default for each action
Event name | Fired |
---|---|
friendrequest.sent | When a friend request is sent |
friendrequest.accepted | When a friend request is accepted |
friendship.deleted | When a friend request is denied |
friendship.deleted | When a friendship is deleted |
for more about how to use the events Check this example
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Amr A. Mohammed
- All Contributors
License
The MIT License (MIT). Please see License File for more information.