BroadcastNotification::broadcastOn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Modules\Notification\Events;
4
5
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Queue\SerializesModels;
8
use Modules\Notification\Entities\Notification;
9
10
class BroadcastNotification implements ShouldBroadcast, ShouldQueue
11
{
12
    use SerializesModels;
13
14
    /**
15
     * @var Notification
16
     */
17
    public $notification;
18
19
    public function __construct(Notification $notification)
20
    {
21
        $this->notification = $notification;
22
    }
23
24
    /**
25
     * Get the channels the event should broadcast on.
26
     * @return array
27
     */
28
    public function broadcastOn()
29
    {
30
        return ['asgardcms.notifications.' . $this->notification->user_id];
31
    }
32
}
33