Completed
Pull Request — master (#4037)
by Muhlis
02:38
created

MultipleImage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
1
<?php
2
3
namespace Tests\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class MultipleImage extends Model
8
{
9
    protected $table = 'test_multiple_images';
10
11
    public function setPicturesAttribute($pictures)
12
    {
13
        if (is_array($pictures)) {
14
            $this->attributes['pictures'] = json_encode($pictures);
15
        }
16
    }
17
18
    public function getPicturesAttribute($pictures)
19
    {
20
        return json_decode($pictures, true) ?: [];
21
    }
22
}
23