This commit is contained in:
slong753 2023-05-10 14:08:12 -05:00
parent 1d2596fc54
commit 5e34ffa2b0

View file

@ -216,22 +216,23 @@ class BulkAssetsController extends Controller
if($custom_fields_present) {
$asset = Asset::find($assetId);
$assetCustomFields = $asset->model()->first()->fieldset;
if($assetCustomFields?->fields) {
foreach ($assetCustomFields?->fields as $field) {
if (array_key_exists($field->db_column, $this->update_array)) {
$asset->{$field->db_column} = $this->update_array[$field->db_column];
$asset->save();
continue;
} else {
$array = $this->update_array;
array_except($array, $field->db_column);
$asset->update($array);
//call update on parent model
$asset->save();
}
if (!$asset->save()) {
$error_bag[] = $asset->getErrors();
}
if($assetCustomFields?->fields) {
foreach ($assetCustomFields?->fields as $field) {
if (array_key_exists($field->db_column, $this->update_array)) {
$asset->{$field->db_column} = $this->update_array[$field->db_column];
$asset->save();
continue;
} else {
$array = $this->update_array;
array_except($array, $field->db_column);
// $asset->update($array);
$asset->save($array);
//call update on parent model
// $asset->save();
}
if (!$asset->save()) {
$error_bag[] = $asset->getErrors();
}
}
}
} else {