Skip to content

Commit 101aa0f

Browse files
committed
fix(laravel): BelongsToMany relations dont have a getForeignKeyName()
1 parent 8f4bc08 commit 101aa0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Laravel/Eloquent/Metadata/ModelMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public function getAttributes(Model $model): array
7676
$columns = $schema->getColumns($table);
7777
$indexes = $schema->getIndexes($table);
7878
$relations = $this->getRelations($model);
79-
80-
$foreignKeys = array_flip(array_column($relations, 'foreign_key'));
79+
80+
$foreignKeys = array_flip(array_filter(array_column($relations, 'foreign_key')));
8181
$attributes = [];
8282

8383
foreach ($columns as $column) {

0 commit comments

Comments
 (0)