PHP code example of eloquent-works / fellowship

1. Go to this page and download the library: Download eloquent-works/fellowship 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/ */

    

eloquent-works / fellowship example snippets


$user->sendFellowshipRequestTo($otherUser);

$otherUser->acceptFellowshipRequestFrom($user);

$user->isFellowshipWith($otherUser);



namespace App\Models;

use EloquentWorks\Fellowship\Traits\HasFellowships;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasFellowships;
}

$request = $user->sendFellowshipRequestTo($otherUser);

$otherUser->acceptFellowshipRequestFrom($user);

$otherUser->denyFellowshipRequestFrom($user);

$user->cancelFellowshipRequestTo($otherUser);

$user->canSendFellowshipRequestTo($otherUser);

$user->isFellowshipWith($otherUser);

$friends = $user->friends();

$count = $user->fellowshipsCount();

$user->removeFellowship($otherUser);

$mutual = $user->mutualFellowshipsWith($otherUser);

$count = $user->mutualFellowshipsCountWith($otherUser);

$user->mutualFellowshipWith($otherUser);
$user->mutualFellowshipCountWith($otherUser);

$user->blockFellowship($otherUser);

$user->unblockFellowship($otherUser);

$user->hasBlocked($otherUser);
$user->isBlockedBy($otherUser);

$user->blockedUsers();
$user->blockedByUsers();

$fellowship = $user->fellowshipWith($otherUser);

$status = $user->fellowshipStatusWith($otherUser);

$user->incomingFellowshipRequests();
$user->outgoingFellowshipRequests();

$user->sentFellowships();
$user->receivedFellowships();
$user->acceptedSentFellowships();
$user->acceptedReceivedFellowships();
$user->pendingSentFellowships();
$user->pendingReceivedFellowships();



use Illuminate\Support\Facades\Route;

Route::fellowship();

Route::fellowship([
    'prefix' => 'connections',
    'name' => 'connections.',
    'middleware' => ['web', 'auth', 'verified'],
]);

return [
    'models' => [
        'fellowship' => EloquentWorks\Fellowship\Models\Fellowship::class,
        'user' => null,
    ],

    'tables' => [
        'users' => 'users',
        'fellowships' => 'fellowships',
    ],

    'routes' => [
        'prefix' => 'fellowship',
        'middleware' => ['web', 'auth'],
        'name' => 'fellowship.',
    ],

    'expires_after_days' => 30,
    'request_cooldown_days' => 7,
    'dispatch_events' => true,
];

'dispatch_events' => false,

use Illuminate\Support\Facades\Schedule;

Schedule::command('fellowships:expire')->daily();
bash
php artisan fellowship:install
bash
php artisan fellowship:install --routes
bash
php artisan migrate
bash
php artisan vendor:publish --tag=fellowship-config
bash
php artisan fellowships:expire
bash
php artisan fellowships:expire --chunk=500