BaseModelEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 44
ccs 0
cts 16
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A broadcastOn() 0 4 1
A getModel() 0 4 1
A setModel() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: alive
5
 * Date: 12/11/17
6
 * Time: 7:55 AM
7
 */
8
9
namespace Alive2212\LaravelModelEventService\Events;
10
11
use Illuminate\Queue\SerializesModels;
12
use Illuminate\Broadcasting\PrivateChannel;
13
use Illuminate\Foundation\Events\Dispatchable;
14
use Illuminate\Broadcasting\InteractsWithSockets;
15
16
17
class BaseModelEvent
18
{
19
    use Dispatchable, InteractsWithSockets, SerializesModels;
20
21
    /**
22
     * @var
23
     */
24
    protected $model;
25
26
    /**
27
     * Create a new event instance.
28
     * @param $model
29
     */
30
    public function __construct($model)
31
    {
32
        $this->model = $model[0];
33
    }
34
35
    /**
36
     * Get the channels the event should broadcast on.
37
     *
38
     * @return PrivateChannel
39
     */
40
    public function broadcastOn()
41
    {
42
        return new PrivateChannel('channel-name');
43
    }
44
45
    /**
46
     * @return mixed
47
     */
48
    public function getModel()
49
    {
50
        return $this->model;
51
    }
52
53
    /**
54
     * @param mixed $model
55
     */
56
    public function setModel($model)
57
    {
58
        $this->model = $model;
59
    }
60
}