File tree 1 file changed +9
-2
lines changed 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,21 @@ public function mountedFields(Collection $fields): void
31
31
32
32
public function updatedFields (mixed $ value , string $ key ): void
33
33
{
34
- $ this ->validateOnly ("fields. {$ key }" );
34
+ /**
35
+ * When handling array fields like checkboxes, the $key can look like "services.value.0".
36
+ * This can cause issues with validation, since it targets a specific item instead of the whole array.
37
+ * The following code fixes this by pointing the $key to the full array "services.value" instead.
38
+ */
39
+ $ key = str ($ key )->explode ('. ' )->slice (0 , 2 )->prepend ('fields ' )->join ('. ' );
40
+
41
+ $ this ->validateOnly ($ key );
35
42
36
43
/**
37
44
* Explicitly forget the errors of this field after validation has passed
38
45
* so that we don't restore them in some edge case scenarios.
39
46
*/
40
47
if ($ this ->isWizardForm ()) {
41
- $ this ->resetStepErrorBag (" fields. { $ key}" );
48
+ $ this ->resetStepErrorBag ($ key );
42
49
}
43
50
}
44
51
You can’t perform that action at this time.
0 commit comments