Skip to content

Commit

Permalink
Adds incrementing pivot key support
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed May 15, 2024
1 parent cf8b4cb commit 6b1d99a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Database/Relations/DefinedConstraints.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public function addDefinedConstraintsToRelation($relation, array $args = null)
$relation->withPivot($pivotData);
}

// Pivot incrementing key (belongsToMany, morphToMany, morphByMany)
if ($pivotKey = array_get($args, 'pivotKey')) {
$relation->withPivot($pivotKey);
}

// Pivot timestamps (belongsToMany, morphToMany, morphByMany)
if (array_get($args, 'timestamps')) {
$relation->withTimestamps();
Expand Down

0 comments on commit 6b1d99a

Please sign in to comment.