Skip to content

Commit 789a70b

Browse files
authored
Merge pull request #478 from urakozz/v5
update getRelationCountHash (support laravel 8.17+)
2 parents 1edd06d + b2c98cc commit 789a70b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/BaseRelation.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,12 @@ public function getRelationQuery(
128128
/**
129129
* Get a relationship join table hash.
130130
*
131+
* @param bool $incrementJoinCount
131132
* @return string
132133
*/
133-
public function getRelationCountHash()
134+
public function getRelationCountHash($incrementJoinCount = true)
134135
{
135-
return 'nested_set_'.self::$selfJoinCount++;
136+
return 'nested_set_'.($incrementJoinCount ? static::$selfJoinCount++ : static::$selfJoinCount);
136137
}
137138

138139
/**
@@ -208,4 +209,4 @@ protected function matchForModel(Model $model, EloquentCollection $results)
208209

209210
return $result;
210211
}
211-
}
212+
}

0 commit comments

Comments
 (0)