Skip to content

Commit 0c864d0

Browse files
Merge pull request #48 from diegohq/HasManyThroughFix
HasManyThrough relation fix
2 parents 924735e + 38344c3 commit 0c864d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Parser.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,10 @@ protected function parseWith($withParam)
391391
$firstKey = $relation->getQualifiedParentKeyName();
392392
$secondKey = $relation->getRelated()->getQualifiedKeyName();
393393
} else if ($relationType === 'HasManyThrough') {
394-
if (method_exists($relation, 'getExistenceCompareKey')) {
394+
if (method_exists($relation, 'getQualifiedLocalKeyName')) {
395+
$firstKey = $relation->getQualifiedLocalKeyName();
396+
} else if (method_exists($relation, 'getExistenceCompareKey')) {
397+
// compatibility for laravel 5.4
395398
$firstKey = $relation->getExistenceCompareKey();
396399
} else {
397400
// compatibility for laravel < 5.4

0 commit comments

Comments
 (0)