finish custom fields in edit

This commit is contained in:
xiaomlove
2021-03-04 02:27:39 +08:00
parent 723a6fadc9
commit 7c857deaf4
4 changed files with 58 additions and 19 deletions
+10 -8
View File
@@ -359,14 +359,16 @@ $id = mysql_insert_id();
if (!empty($_POST['custom_fields'])) {
$now = date('Y-m-d H:i:s');
foreach ($_POST['custom_fields'] as $customField => $customValue) {
$customData = [
'torrent_id' => $id,
'custom_field_id' => $customField,
'custom_field_value' => serialize($customValue),
'created_at' => $now,
'updated_at' => $now,
];
\Nexus\Database\DB::insert('torrents_custom_field_values', $customData);
foreach ((array)$customValue as $value) {
$customData = [
'torrent_id' => $id,
'custom_field_id' => $customField,
'custom_field_value' => $value,
'created_at' => $now,
'updated_at' => $now,
];
\Nexus\Database\DB::insert('torrents_custom_field_values', $customData);
}
}
}