Skip to content

Commit debbc8f

Browse files
laylatichygitbutler-client
authored andcommitted
refactor(database): use resolvePivotTable() in BelongsToMany::query() instead of duplicating pivot logic
1 parent bbbb319 commit debbc8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/database/src/BelongsToMany.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public function query(PrimaryKey $primaryKey, null|string|UnitEnum $onDatabase =
408408
$targetTable = $targetModel->getTableName();
409409
$targetPK = $targetModel->getPrimaryKey();
410410

411-
$pivotTable = $this->pivot ?? arr([$ownerTable, $targetTable])->sort()->implode('_')->toString();
411+
$pivotTable = $this->resolvePivotTable(ownerModel: $ownerModel, targetModel: $targetModel);
412412
$ownerFK = $this->ownerJoin ?? str(string: $ownerTable)->singularizeLastWord() . '_' . $ownerPK;
413413
$targetFK = $this->relatedOwnerJoin ?? str(string: $targetTable)->singularizeLastWord() . '_' . $targetPK;
414414

0 commit comments

Comments
 (0)