Added field to controller and tranformer

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-11-08 15:26:59 +00:00
parent 7c21158680
commit 52dc5aa4ba
2 changed files with 3 additions and 0 deletions

View file

@ -94,6 +94,7 @@ class CustomFieldsController extends Controller
"field_encrypted" => $request->get("field_encrypted", 0), "field_encrypted" => $request->get("field_encrypted", 0),
"show_in_email" => $request->get("show_in_email", 0), "show_in_email" => $request->get("show_in_email", 0),
"is_unique" => $request->get("is_unique", 0), "is_unique" => $request->get("is_unique", 0),
"display_in_user_view" => $request->get("display_in_user_view", 0),
"user_id" => Auth::id() "user_id" => Auth::id()
]); ]);
@ -228,6 +229,7 @@ class CustomFieldsController extends Controller
$field->help_text = $request->get("help_text"); $field->help_text = $request->get("help_text");
$field->show_in_email = $request->get("show_in_email", 0); $field->show_in_email = $request->get("show_in_email", 0);
$field->is_unique = $request->get("is_unique", 0); $field->is_unique = $request->get("is_unique", 0);
$field->display_in_user_view = $request->get("display_in_user_view", 0);
if ($request->get('format') == 'CUSTOM REGEX') { if ($request->get('format') == 'CUSTOM REGEX') {
$field->format = e($request->get('custom_format')); $field->format = e($request->get('custom_format'));

View file

@ -47,6 +47,7 @@ class CustomFieldsTransformer
'field_values_array' => ($field->field_values) ? explode("\r\n", e($field->field_values)) : null, 'field_values_array' => ($field->field_values) ? explode("\r\n", e($field->field_values)) : null,
'type' => e($field->element), 'type' => e($field->element),
'required' => (($field->pivot) && ($field->pivot->required=='1')) ? true : false, 'required' => (($field->pivot) && ($field->pivot->required=='1')) ? true : false,
'display_in_user_view' => ($field->display_in_user_view =='1') ? true : false,
'created_at' => Helper::getFormattedDateObject($field->created_at, 'datetime'), 'created_at' => Helper::getFormattedDateObject($field->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($field->updated_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($field->updated_at, 'datetime'),
]; ];