Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public function set($model, $key, $value, $attributes) |
||
36 | { |
||
37 | if($value instanceof Collection){ |
||
38 | $value = $value->toJson(); |
||
39 | }else { |
||
40 | $value = json_encode($value); |
||
41 | |||
42 | if ($value === false) { |
||
43 | throw JsonEncodingException::forAttribute( |
||
44 | $this, $key, json_last_error_msg() |
||
45 | ); |
||
46 | } |
||
47 | } |
||
48 | |||
49 | return parent::set($model, $key, $value, $attributes); |
||
50 | } |
||
51 | } |
||
52 |