@@ -32,16 +32,18 @@ public function compactFakeFields($requestInput, $model = false, $fields = [])
3232
3333 foreach ($ fields as $ field ) {
3434 // compact fake fields
35- // cast the field name to array first, to account for array field names
36- // in fields that send multiple inputs and want them all saved to the database
37- foreach (( array ) $ field ['name ' ] as $ fieldName ) {
35+ // explode the comma delimited names, eg: start,end in a date_range:
36+ $ field [ ' name ' ] = explode ( ' , ' , $ field [ ' name ' ]);
37+ foreach ($ field ['name ' ] as $ fieldName ) {
3838 $ fakeFieldKey = isset ($ field ['store_in ' ]) ? $ field ['store_in ' ] : 'extras ' ;
3939 $ isFakeField = $ field ['fake ' ] ?? false ;
4040
4141 // field is represented by the subfields
4242 if (isset ($ field ['subfields ' ]) && isset ($ field ['model ' ]) && $ field ['model ' ] === get_class ($ model )) {
4343 foreach ($ field ['subfields ' ] as $ subfield ) {
44- foreach ((array ) $ subfield ['name ' ] as $ subfieldName ) {
44+ // explode the comma delimited names, eg: start,end in a date_range:
45+ $ subfield ['name ' ] = explode (', ' , $ subfield ['name ' ]);
46+ foreach ($ subfield ['name ' ] as $ subfieldName ) {
4547 $ subfieldName = Str::afterLast ($ subfieldName , '. ' );
4648 $ isSubfieldFake = $ subfield ['fake ' ] ?? false ;
4749 $ subFakeFieldKey = isset ($ subfield ['store_in ' ]) ? $ subfield ['store_in ' ] : 'extras ' ;
0 commit comments