PHP code example of buoy / lighthouse-fairway

1. Go to this page and download the library: Download buoy/lighthouse-fairway 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/ */

    

buoy / lighthouse-fairway example snippets




namespace App\GraphQL\Subscriptions;

use Buoy\LighthouseFairway\Subscriptions\FairwayModelEventSubscription;
use Illuminate\Http\Request;
use Nuwave\Lighthouse\Subscriptions\Subscriber;

class FairwayModelSubscription extends FairwayModelEventSubscription
{
    public function authorize(Subscriber $subscriber, Request $request): bool
    {
        // Authorize the user
        return true;
    }

    public function filterSubscription(Subscriber $subscriber, $root): bool
    {
        // Add filtering here. Filtering based on event type is handled for you.
        return true;
    }
}

$note = App\Models\Note::first();
Buoy\LighthouseFairway\Util\Broadcast::modelEvent($note, 'update');
shell
php artisan vendor:publish --tag=lighthouse-fairway-config  
graphql
type Note @subscribable {
    id
    text
}