Skip to content

Commit bc1fd4c

Browse files
authored
fix(laravel): belongs-to-many relations dont have a get-foreign-key-name method (#7589)
1 parent d3bcded commit bc1fd4c

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
@@ -77,7 +77,7 @@ public function getAttributes(Model $model): array
7777
$indexes = $schema->getIndexes($table);
7878
$relations = $this->getRelations($model);
7979

80-
$foreignKeys = array_flip(array_column($relations, 'foreign_key'));
80+
$foreignKeys = array_flip(array_filter(array_column($relations, 'foreign_key')));
8181
$attributes = [];
8282

8383
foreach ($columns as $column) {

0 commit comments

Comments
 (0)