Download the PHP package gridprinciples/friendly without Composer
On this page you can find all versions of the php package gridprinciples/friendly. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gridprinciples/friendly
More information about gridprinciples/friendly
Files in gridprinciples/friendly
Package friendly
Short Description Friends system for users, on Laravel.
License
Informations about the package friendly
Friendly 
A Laravel 5.1 package designed to enhance Eloquent users with connections between users, including approvals by both users and additional data.
Friendly includes many shortcuts to creating one's own Friend system, but the developer is free to implement the details however they require.
Installation
- Run
composer require gridprinciples/friendly
from your project directory. -
Add the following to the
providers
array inconfig/app.php
: -
Publish the migrations and config file:
-
Run the migrations:
This will add a
friends
table to your database to track relationships between models.
Usage
Add the Friendly
trait to your User model:
use Friendly;
You may now relate users to each other:
Pivot Data
The included implementation table includes the following additional information about each friend request:
name
: Describes the requesting user's relationship with the secondary user.other_name
: Describes the secondary user's relationship with the requesting user.start
: When the relationship started, or will start.end
: When the relationship
Reloading the Connections
When time you access the "friends" property on a user Model, the connections will be loaded and cached. If you make changes to a different relationship which would affect a loaded user's friends, you might need to reload them: