From f7bb911b99e769fb572ed9efd149c68c3b92e5a2 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 17 Oct 2023 19:06:53 -0500 Subject: [PATCH] clean up --- app/Http/Controllers/Api/AssetsController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 4d146d361f..bce5354b72 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -578,14 +578,15 @@ class AssetsController extends Controller if (($model) && ($model->fieldset)) { foreach ($model->fieldset->fields as $field) { - //reduce "array to string conversion" exceptions - ideally we'd handle this in a form request, but this works for now - if(is_array($request->input($field->db_column, null))) { - return response()->json(Helper::formatStandardApiResponse('error', null, 'This custom field can not be an array', 200)); - } // Set the field value based on what was sent in the request $field_val = $request->input($field->db_column, null); + //reduce "array to string conversion" exceptions - ideally we'd handle this in a form request, but this works for now + if(is_array($field_val)) { + return response()->json(Helper::formatStandardApiResponse('error', null, 'This custom field can not be an array', 200)); + } + // If input value is null, use custom field's default value if ($field_val == null) { \Log::debug('Field value for '.$field->db_column.' is null');