1 | <?php |
||
2 | |||
3 | namespace App\Events; |
||
4 | |||
5 | use App\Models\Candidate; |
||
6 | use Illuminate\Broadcasting\InteractsWithSockets; |
||
7 | use Illuminate\Broadcasting\PrivateChannel; |
||
8 | use Illuminate\Foundation\Events\Dispatchable; |
||
9 | use Illuminate\Queue\SerializesModels; |
||
10 | |||
11 | class CandidateRated |
||
12 | { |
||
13 | use Dispatchable; |
||
14 | use InteractsWithSockets; |
||
15 | use SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
16 | |||
17 | /** |
||
18 | * @var Candidate |
||
19 | */ |
||
20 | public $candidate; |
||
21 | |||
22 | public $userId; |
||
23 | public $previousRate; |
||
24 | public $newRate; |
||
25 | |||
26 | /** |
||
27 | * Create a new event instance. |
||
28 | * |
||
29 | * @param Candidate $candidate |
||
30 | * @param $previousRate |
||
31 | * @param $newRate |
||
32 | * @param $userId |
||
33 | */ |
||
34 | public function __construct(Candidate $candidate, $previousRate, $newRate, $userId) |
||
35 | { |
||
36 | $this->candidate = $candidate; |
||
37 | $this->previousRate = $previousRate; |
||
38 | $this->newRate = $newRate; |
||
39 | $this->userId = $userId; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Get the channels the event should broadcast on. |
||
44 | * |
||
45 | * @return \Illuminate\Broadcasting\Channel|array |
||
46 | */ |
||
47 | public function broadcastOn() |
||
48 | { |
||
49 | return new PrivateChannel('channel-name'); |
||
50 | } |
||
51 | } |
||
52 |