Completed
Push — master ( e37096...d041e8 )
by Abdelrahman
01:12 queued 11s
created

ContactDeleted::broadcastOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Contacts\Events;
6
7
use Rinvex\Contacts\Models\Contact;
8
use Illuminate\Broadcasting\Channel;
9
use Illuminate\Queue\SerializesModels;
10
use Illuminate\Broadcasting\InteractsWithSockets;
11
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
12
13
class ContactDeleted implements ShouldBroadcast
14
{
15
    use SerializesModels;
16
    use InteractsWithSockets;
17
18
    public $contact;
19
20
    /**
21
     * Create a new event instance.
22
     *
23
     * @param \Rinvex\Contacts\Models\Contact $contact
24
     */
25
    public function __construct(Contact $contact)
26
    {
27
        $this->contact = $contact;
28
    }
29
30
    /**
31
     * Get the channels the event should broadcast on.
32
     *
33
     * @return \Illuminate\Broadcasting\Channel
34
     */
35
    public function broadcastOn()
36
    {
37
        return new Channel($this->formatChannelName());
38
    }
39
40
    /**
41
     * The event's broadcast name.
42
     *
43
     * @return string
44
     */
45
    public function broadcastAs()
46
    {
47
        return 'rinvex.contacts.deleted';
48
    }
49
50
    /**
51
     * Format channel name.
52
     *
53
     * @return string
54
     */
55
    protected function formatChannelName(): string
56
    {
57
        return 'rinvex.contacts.list';
58
    }
59
}
60