We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d015494 + 2dadcfc commit f4dad20Copy full SHA for f4dad20
src/app/Library/CrudPanel/Traits/Create.php
@@ -121,6 +121,11 @@ private function createRelationsForItem($item, $formattedRelations)
121
case 'MorphToMany':
122
$values = $relationDetails['values'][$relationMethod] ?? [];
123
$values = is_string($values) ? json_decode($values, true) : $values;
124
+
125
+ // disabling ConvertEmptyStringsToNull middleware may return null from json_decode() if an empty string is used.
126
+ // we need to make sure no null value can go foward so we reassure that values is not null after json_decode()
127
+ $values = $values ?? [];
128
129
$relationValues = [];
130
131
if (is_array($values) && is_multidimensional_array($values)) {
0 commit comments