PHP code example of gridprinciples / friendly

1. Go to this page and download the library: Download gridprinciples/friendly library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gridprinciples / friendly example snippets


    GridPrinciples\Friendly\Providers\FriendlyServiceProvider::class,
    


// Using the "requesting" user model...
$dad = User::where('name', 'darth')->first();

// ...and the one receiving the friend request...
$kid = User::where('name', 'luke')->first();

// may ($dad);

// At this point, either user is associated with the other via their `friends` attribute (a Collection):
$relatives = $kid->friends->toArray();

// Either user may sever the relationship, resulting in a type of block:
$kid->block($dad);


$user->resetFriends();

    php artisan vendor:publish --provider="GridPrinciples\Friendly\Providers\FriendlyServiceProvider"
    

    php artisan migrate