Total Complexity | 6 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 91.67% |
Changes | 0 |
1 | <?php |
||
13 | class MessagingInfo extends Model |
||
14 | { |
||
15 | protected $guarded = []; |
||
16 | protected $appends = [ |
||
17 | 'startTime', |
||
18 | 'endTime' |
||
19 | ]; |
||
20 | |||
21 | 1 | public function getStartTimeAttribute() |
|
24 | } |
||
25 | |||
26 | 1 | public function getEndTimeAttribute() |
|
27 | { |
||
28 | 1 | if ($this->attributes['status'] == 'CLOSE') { |
|
29 | 1 | return new Carbon($this->attributes['endTime']); |
|
30 | } else { |
||
31 | return null; |
||
32 | } |
||
33 | } |
||
34 | |||
35 | 1 | public function getMinutesAttribute() |
|
36 | { |
||
37 | 1 | return round(($this->attributes['duration'] / 1000) / 60, 2); |
|
38 | } |
||
39 | |||
40 | 1 | public function getSecondsAttribute() |
|
41 | { |
||
42 | 1 | return $this->attributes['duration'] / 1000; |
|
43 | } |
||
44 | |||
45 | 1 | public function getHoursAttribute() |
|
48 | } |
||
49 | } |
||
50 |