1
<?php
2

3
namespace Nuwave\Lighthouse\Subscriptions;
4

5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Queue\SerializesModels;
8
use Nuwave\Lighthouse\Schema\Types\GraphQLSubscription;
9
use Nuwave\Lighthouse\Subscriptions\Contracts\BroadcastsSubscriptions;
10

11
class BroadcastSubscriptionJob implements ShouldQueue
12
{
13
    use Queueable, SerializesModels;
14

15
    /**
16
     * The subscription field that was requested.
17
     *
18
     * @var \Nuwave\Lighthouse\Schema\Types\GraphQLSubscription
19
     */
20
    public $subscription;
21

22
    /**
23
     * The name of the field.
24
     *
25
     * @var string
26
     */
27
    public $fieldName;
28

29
    /**
30
     * The root element to be passed when resolving the subscription.
31
     *
32
     * @var mixed User defined.
33
     */
34
    public $root;
35

36 0
    public function __construct(GraphQLSubscription $subscription, string $fieldName, $root)
37
    {
38 0
        $this->subscription = $subscription;
39 0
        $this->fieldName = $fieldName;
40 0
        $this->root = $root;
41
    }
42

43 0
    public function handle(BroadcastsSubscriptions $broadcaster): void
44
    {
45 0
        $broadcaster->broadcast($this->subscription, $this->fieldName, $this->root);
46
    }
47
}

Read our documentation on viewing source code .

Loading