Skip to content

Commit

Permalink
Merge ab33130 into 9b4f5bf
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuscnielsen committed Sep 8, 2020
2 parents 9b4f5bf + ab33130 commit e0a0958
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Cloner.php
Expand Up @@ -190,6 +190,11 @@ protected function duplicatePivotedRelation($relation, $relation_name, $clone) {
$foreign->pivot->getCreatedAtColumn(),
$foreign->pivot->getUpdatedAtColumn()
]);

if ($foreign->pivot->incrementing) {
unset($pivot_attributes[$foreign->pivot->getKeyName()]);
}

$clone->$relation_name()->attach($foreign, $pivot_attributes);
});
}
Expand Down

0 comments on commit e0a0958

Please sign in to comment.