2017 © Pedro Peláez
 

library friendships

This package gives users the ability to manage their friendships.

image

merodiro/friendships

This package gives users the ability to manage their friendships.

  • Friday, June 1, 2018
  • by merodiro
  • Repository
  • 2 Watchers
  • 45 Stars
  • 2,327 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 18 Versions
  • 29 % Grown

The README.md

Laravel 5 Friendships

Latest Version on Packagist ![Software License][ico-license] Build Status ![Build status][ico-appveyor] Coverage Status ![Quality Score][ico-code-quality] Total Downloads, (*1)

This package gives users the ability to manage their friendships., (*2)

Models can:

  • Send Friend Requests
  • Accept Friend Requests
  • Deny Friend Requests
  • Delete Friend

Installation

First, install the package through Composer., (*3)

composer require merodiro/friendships

Then include the service provider inside config/app.php., (*4)

'providers' => [
    ...
    Merodiro\Friendships\FriendshipsServiceProvider::class,
    ...
];

Finally, migrate the database, (*5)

php artisan migrate

Setup a Model

use Merodiro\Friendships\Friendable;
class User extends Model
{
    use Friendable;
    ...
}

How to use

Check the Test file to see the package in action, (*6)

Send a Friend Request

$user->addFriend($recipient);

Accept a Friend Request

$user->acceptFriend($sender);

Deny a Friend Request

$user->deleteFriend($sender);

Remove Friend

$user->deleteFriend($friend);

Mutual Friends

$user->mutualFriends($anotherUser);

check the current relationship between two users

$user->checkFriendship($anotherUser);

it returns, (*7)

  • same_user => if the $user is checking his own account
  • friends => if they are friends
  • waiting => 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

$user->isFriendsWith($anotherUser);

it returns true if they are friends and false if they aren't, (*8)

Friends

To get a collection of users use the following methods:, (*9)

Get Friends

$user->friends();

Get a list of users that $user has received friend requests from

$user->friendRequestsReceived();

Get a list of users that $user has sent friend requests to

$user->friendRequestsSent();

Events

This is the list of the events fired by default for each action, (*10)

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, (*11)

Testing

bash $ composer test, (*12)

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*13)

Security

If you discover any security-related issues, please email merodiro@gmail.com instead of using the issue tracker., (*14)

Credits

License

The MIT License (MIT). Please see License File for more information., (*15)

The Versions

01/06 2018

dev-master

9999999-dev

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

16/05 2018

v1.2.4

1.2.4.0

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

16/05 2018

v1.2.3

1.2.3.0

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

16/05 2018

v1.2.2

1.2.2.0

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

16/05 2018

v1.2.1

1.2.1.0

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

16/05 2018

v1.2.0

1.2.0.0

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

24/01 2018

dev-dev

dev-dev

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

18/01 2018

v1.1.0

1.1.0.0

This package gives users the ability to manage their friendships.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

01/12 2017

v1.0.0

1.0.0.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

08/07 2017

v0.4.1

0.4.1.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

04/06 2017

v0.4

0.4.0.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

09/05 2017

v0.3

0.3.0.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

09/05 2017

v0.2

0.2.0.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Amr

laravel eloquent friends friendships friend-system

08/05 2017

v0.1.5

0.1.5.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Amr

laravel eloquent friends friendships friend-system

08/05 2017

v0.1.4

0.1.4.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Amr

laravel eloquent friends friendships friend-system

08/05 2017

v0.1.3

0.1.3.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Amr

laravel eloquent friends friendships friend-system

08/05 2017

v0.1.2

0.1.2.0

A simple package for friendships

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Amr

laravel eloquent friends friendships friend-system

08/05 2017

v0.1

0.1.0.0

A simple package for friendships

  Sources   Download

MIT

by Amr

laravel eloquent friends friendships friend-system