CandidateStageChanged::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Events;
4
5
use App\Models\Candidate;
6
use App\Models\User;
7
use Illuminate\Broadcasting\InteractsWithSockets;
8
use Illuminate\Broadcasting\PrivateChannel;
9
use Illuminate\Foundation\Events\Dispatchable;
10
use Illuminate\Queue\SerializesModels;
11
use Illuminate\Support\Facades\Auth;
12
13
class CandidateStageChanged
14
{
15
    use Dispatchable;
16
    use InteractsWithSockets;
17
    use SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Events\CandidateStageChanged: $id, $relations, $class, $connection, $keyBy
Loading history...
18
19
    /**
20
     * @var Candidate
21
     */
22
    public $candidate;
23
24
    /**
25
     * @var User
26
     */
27
    public $user;
28
29
    public $previousStage;
30
    public $newStage;
31
32
    /**
33
     * Create a new event instance.
34
     *
35
     * @param Candidate $candidate
36
     * @param $previousStage
37
     * @param $newStage
38
     */
39
    public function __construct(Candidate $candidate, $previousStage, $newStage)
40
    {
41
        $this->candidate = $candidate;
42
        $this->previousStage = $previousStage;
43
        $this->newStage = $newStage;
44
        $this->user = Auth::user();
45
    }
46
47
    /**
48
     * Get the channels the event should broadcast on.
49
     *
50
     * @return \Illuminate\Broadcasting\Channel|array
51
     */
52
    public function broadcastOn()
53
    {
54
        return new PrivateChannel('channel-name');
55
    }
56
}
57