Total Complexity | 4 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class UserPresent implements ShouldBroadcastNow |
||
13 | { |
||
14 | use Dispatchable, InteractsWithSockets, SerializesModels; |
||
|
|||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private array $data; |
||
19 | /** |
||
20 | * @var User |
||
21 | */ |
||
22 | private User $user; |
||
23 | |||
24 | /** |
||
25 | * Create a new event instance. |
||
26 | * |
||
27 | * @param User $user |
||
28 | * @param array $data |
||
29 | */ |
||
30 | public function __construct(User $user, array $data) |
||
31 | { |
||
32 | $this->data = $data; |
||
33 | $this->user = $user; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Get the channels the event should broadcast on. |
||
38 | * |
||
39 | * @return \Illuminate\Broadcasting\Channel|array |
||
40 | */ |
||
41 | public function broadcastOn() |
||
42 | { |
||
43 | return new PrivateChannel('comments-'.$this->data['category'].'-'.$this->data['item_id']); |
||
44 | } |
||
45 | |||
46 | public function broadcastWith() |
||
51 | ]; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Broadcast event name. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function broadcastAs() |
||
62 | } |
||
63 | } |
||
64 |