Passed
Push — master ( 9234be...3143c1 )
by Arthur
20:30
created

ProxyDeletedEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 32
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A broadcastWith() 0 3 1
A broadcastAs() 0 3 1
A broadcastOn() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 14.10.18
6
 * Time: 19:31.
7
 */
8
9
namespace Modules\Proxy\Events;
10
11
use Foundation\Abstracts\Events\Event;
12
use Illuminate\Broadcasting\PrivateChannel;
13
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
14
use Modules\Proxy\Entities\Proxy;
15
use Modules\Proxy\Transformers\ProxyTransformer;
16
17
class ProxyDeletedEvent extends Event implements ShouldBroadcast
18
{
19
    public $listeners = [];
20
21
    /**
22
     * @var proxy
23
     */
24
    public $proxy;
25
26
    /**
27
     * ProxyDeletedEvent constructor.
28
     *
29
     * @param $user
30
     */
31
    public function __construct(Proxy $proxy)
32
    {
33
        $this->proxy = $proxy;
34
    }
35
36
    public function broadcastOn()
37
    {
38
        return new PrivateChannel('user.'.$this->proxy->user_id);
0 ignored issues
show
Bug introduced by
The property user_id does not exist on Modules\Proxy\Entities\Proxy. Did you mean user?
Loading history...
39
    }
40
41
    public function broadcastAs()
42
    {
43
        return 'proxy.deleted';
44
    }
45
46
    public function broadcastWith()
47
    {
48
        return ProxyTransformer::resource($this->proxy)->serialize();
49
    }
50
}
51