Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
4 / 4 |
Feature | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
4 / 4 |
getOptionsAttribute | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
setOptionsAttribute | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
serializeDate | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\Entities\Models; |
4 | |
5 | use Illuminate\Database\Eloquent\Model; |
6 | |
7 | class Feature extends Model |
8 | { |
9 | protected $connection = 'entitiesMysql'; |
10 | protected $fillable = ['name', 'icon', 'path', 'path_list', 'service', 'stack', 'options']; |
11 | |
12 | public function getOptionsAttribute($value) |
13 | { |
14 | return !empty($value) ? json_decode($value) : []; |
15 | } |
16 | |
17 | public function setOptionsAttribute($value) |
18 | { |
19 | $this->attributes['options'] = json_encode($value); |
20 | } |
21 | |
22 | /** |
23 | * Prepare a date for array / JSON serialization. |
24 | * |
25 | * @param \DateTimeInterface $date |
26 | * @return string |
27 | */ |
28 | protected function serializeDate(\DateTimeInterface $date) |
29 | { |
30 | return $date->format('Y-m-d H:i:s'); |
31 | } |
32 | } |