|
@@ 192-199 (lines=8) @@
|
| 189 |
|
{ |
| 190 |
|
$defaults = is_array($defaultValue) ? $defaultValue : explode(',', $defaultValue); |
| 191 |
|
$options = array_column($optionValues, 'id'); |
| 192 |
|
if ('MultiSelect' === $type || 'CheckboxGroup' === $type) |
| 193 |
|
{ |
| 194 |
|
$defaultValue = array_values(array_intersect($defaults, $options)); |
| 195 |
|
} |
| 196 |
|
else |
| 197 |
|
{ |
| 198 |
|
$defaultValue = implode(',', array_intersect($defaults, $options)); |
| 199 |
|
} |
| 200 |
|
} |
| 201 |
|
$field = Field::create([ 'project_key' => $project_key, 'optionValues' => $optionValues, 'defaultValue' => $defaultValue ] + $request->all()); |
| 202 |
|
} |
|
@@ 295-302 (lines=8) @@
|
| 292 |
|
$options = array_column($optionValues, 'id'); |
| 293 |
|
$defaultValue = isset($defaultValue) ? $defaultValue : ($field->defaultValue ?: ''); |
| 294 |
|
$defaults = is_array($defaultValue) ? $defaultValue : explode(',', $defaultValue); |
| 295 |
|
if ('MultiSelect' === $field->type || 'CheckboxGroup' === $field->type) |
| 296 |
|
{ |
| 297 |
|
$defaultValue = array_values(array_intersect($defaults, $options)); |
| 298 |
|
} |
| 299 |
|
else |
| 300 |
|
{ |
| 301 |
|
$defaultValue = implode(',', array_intersect($defaults, $options)); |
| 302 |
|
} |
| 303 |
|
$updValues['defaultValue'] = $defaultValue; |
| 304 |
|
} |
| 305 |
|
} |