Test Setup Failed
Push — vue-test ( c87041...4c6bf5 )
by Tony
04:34
created

SettingUpdated   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 29
rs 10
c 1
b 0
f 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A broadcastOn() 0 4 1
1
<?php
2
3
namespace App\Events;
4
5
use Illuminate\Broadcasting\Channel;
6
use Illuminate\Broadcasting\InteractsWithSockets;
7
use Illuminate\Broadcasting\PrivateChannel;
8
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
9
use Illuminate\Foundation\Events\Dispatchable;
10
11
class SettingUpdated implements ShouldBroadcast
12
{
13
    use Dispatchable, InteractsWithSockets;
14
15
    public $setting;
16
    public $value;
17
18
    /**
19
     * Create a new event instance.
20
     *
21
     * @param $setting
22
     * @param $value
23
     */
24
    public function __construct($setting, $value)
25
    {
26
        $this->setting = $setting;
27
        $this->value = $value;
28
    }
29
30
    /**
31
     * Get the channels the event should broadcast on.
32
     *
33
     * @return Channel|array
34
     */
35
    public function broadcastOn()
36
    {
37
        return [new PrivateChannel('settings'), new PrivateChannel('settings.'.$this->setting)];
38
    }
39
}
40