Skip to content

Commit

Permalink
Merge pull request #48 from diegohq/HasManyThroughFix
Browse files Browse the repository at this point in the history
HasManyThrough relation fix
  • Loading branch information
marcelgwerder authored Feb 4, 2018
2 parents 924735e + 38344c3 commit 0c864d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ protected function parseWith($withParam)
$firstKey = $relation->getQualifiedParentKeyName();
$secondKey = $relation->getRelated()->getQualifiedKeyName();
} else if ($relationType === 'HasManyThrough') {
if (method_exists($relation, 'getExistenceCompareKey')) {
if (method_exists($relation, 'getQualifiedLocalKeyName')) {
$firstKey = $relation->getQualifiedLocalKeyName();
} else if (method_exists($relation, 'getExistenceCompareKey')) {
// compatibility for laravel 5.4
$firstKey = $relation->getExistenceCompareKey();
} else {
// compatibility for laravel < 5.4
Expand Down

0 comments on commit 0c864d0

Please sign in to comment.