Skip to content

Commit

Permalink
Fix the issue for non-incrementing ids as gently as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
edgrosvenor committed Nov 28, 2024
1 parent 8ffd13c commit 0dc4d64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Illuminate/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,12 @@ public function foreignIdFor($model, $column = null)
->referencesModelColumn($model->getKeyName());
}

if ($model->getKeyType() === 'int') {
return $this->foreignId($column)
->table($model->getTable())
->referencesModelColumn($model->getKeyName());
}

return $this->foreignUuid($column)
->table($model->getTable())
->referencesModelColumn($model->getKeyName());
Expand Down

0 comments on commit 0dc4d64

Please sign in to comment.