| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 68 | public function addValues(array $values): bool |
||
| 69 | { |
||
| 70 | if ($this->values) { |
||
| 71 | $this->values->delete(); |
||
| 72 | } |
||
| 73 | |||
| 74 | foreach ($values as $key => $value) { |
||
| 75 | $customFieldsValue = new CustomFieldsValues(); |
||
| 76 | $customFieldsValue->custom_fields_id = $this->getId(); |
||
| 77 | $customFieldsValue->label = $value; |
||
| 78 | $customFieldsValue->value = $key; |
||
| 79 | $customFieldsValue->saveOrFail(); |
||
| 80 | } |
||
| 81 | |||
| 82 | |||
| 83 | return true; |
||
| 84 | } |
||
| 86 |