Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
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 |
public function __construct(GraphQLSubscription $subscription, string $fieldName, $root) |
|
37 |
{
|
|
38 |
$this->subscription = $subscription; |
|
39 |
$this->fieldName = $fieldName; |
|
40 |
$this->root = $root; |
|
41 |
}
|
|
42 |
|
|
43 |
public function handle(BroadcastsSubscriptions $broadcaster): void |
|
44 |
{
|
|
45 |
$broadcaster->broadcast($this->subscription, $this->fieldName, $this->root); |
|
46 |
}
|
|
47 |
}
|
Read our documentation on viewing source code .