Skip to content

Commit 0624f5f

Browse files
committed
fix(laravel): index on non-primary key
fixes #7182
1 parent 0a1a1ea commit 0624f5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Laravel/Eloquent/Metadata/ModelMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function getAttributes(Model $model): Collection
106106
private function isColumnPrimaryKey(array $indexes, string $column): bool
107107
{
108108
foreach ($indexes as $index) {
109-
if (\in_array($column, $index['columns'], true)) {
109+
if (\in_array($column, $index['columns'], true) && (true === $index['primary'] ?? false)) {
110110
return true;
111111
}
112112
}

0 commit comments

Comments
 (0)