Skip to content

Commit 8daa462

Browse files
committed
fix(laravel): belongs to many relations dont have a get foreign key name() method
1 parent 8f4bc08 commit 8daa462

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)