diff --git a/src/Repositories/Behaviors/HandleFiles.php b/src/Repositories/Behaviors/HandleFiles.php index f935b40d3..0a5fe4034 100644 --- a/src/Repositories/Behaviors/HandleFiles.php +++ b/src/Repositories/Behaviors/HandleFiles.php @@ -120,7 +120,8 @@ public function afterDuplicateHandleFiles(TwillModelContract $object, TwillModel return [ $file->id => Collection::make($object->files()->getPivotColumns())->mapWithKeys( function ($attribute) use ($file) { - return [$attribute => $file->pivot->$attribute]; + $value = $attribute == 'id' ? null : $file->pivot->$attribute; + return [$attribute => $value]; } )->toArray(), ];