All Projects → merodiro → Friendships

merodiro / Friendships

Licence: MIT license
a package for Friendships system

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Friendships

Partyline
Output to Laravel's console from outside of your Command classes.
Stars: ✭ 168 (+273.33%)
Mutual labels:  laravel-5-package
Voyager Hooks
Hooks system integrated into Voyager.
Stars: ✭ 200 (+344.44%)
Mutual labels:  laravel-5-package
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (+428.89%)
Mutual labels:  laravel-5-package
Laravel Cart Manager
Managing the cart in your Laravel/E-commerce application is a breeze
Stars: ✭ 175 (+288.89%)
Mutual labels:  laravel-5-package
Laradmin
Laradmin后台管理系统
Stars: ✭ 197 (+337.78%)
Mutual labels:  laravel-5-package
Hooks
Hooks is a extension system for your Laravel application.
Stars: ✭ 202 (+348.89%)
Mutual labels:  laravel-5-package
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+4815.56%)
Mutual labels:  laravel-5-package
Laravel Gitscrum
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
Stars: ✭ 2,686 (+5868.89%)
Mutual labels:  laravel-5-package
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (+340%)
Mutual labels:  laravel-5-package
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (+411.11%)
Mutual labels:  laravel-5-package
Laravel Translation Manager
Enhanced Management of Laravel 4 & 5 Translations, with Yandex Translation API assisted translations.
Stars: ✭ 178 (+295.56%)
Mutual labels:  laravel-5-package
Laravel Tournaments
Laravel Package that allows you to generate customizable tournaments trees.
Stars: ✭ 196 (+335.56%)
Mutual labels:  laravel-5-package
Sneaker
An easy way to send emails whenever an exception occurs on server.
Stars: ✭ 223 (+395.56%)
Mutual labels:  laravel-5-package
Lapse
Laravel Self Hosted Tiny Error Tracking System With Notifications
Stars: ✭ 172 (+282.22%)
Mutual labels:  laravel-5-package
Laracrud
Laravel Code Generator based on MySQL Database
Stars: ✭ 238 (+428.89%)
Mutual labels:  laravel-5-package
Laravel Page Speed
Package to optimize your site automatically which results in a 35%+ optimization
Stars: ✭ 2,097 (+4560%)
Mutual labels:  laravel-5-package
Voyager Frontend
The Missing Front-end for The Missing Laravel Admin 🔥
Stars: ✭ 200 (+344.44%)
Mutual labels:  laravel-5-package
two-factor-authentication
Two Factor Authentication for Laravel
Stars: ✭ 21 (-53.33%)
Mutual labels:  laravel-5-package
Bouncer
Eloquent roles and abilities.
Stars: ✭ 2,763 (+6040%)
Mutual labels:  laravel-5-package
Laravel Jwt
Dead simple, plug and play JWT API Authentication for Laravel (5.4+)
Stars: ✭ 225 (+400%)
Mutual labels:  laravel-5-package

Laravel 5 Friendships

Latest Version on Packagist Software License Build Status Build status Coverage Status Quality Score Total Downloads

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.

composer require merodiro/friendships

Then include the service provider inside config/app.php.

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

Finally, migrate the database

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

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

  • 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

Friends

To get a collection of users use the following methods:

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

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

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].