Closed odinns closed 3 years ago
Confirmed, the "ensureRelationshipExists" method in "RelationSearch" does not take into account nested relations
Tried a "quick fix", if you replace the current content (I run php8 so some changes might be required) with the following:
if (!str_contains($relation, '.')) {
$query->getRelation($relation);
}
$parts = explode('.', $relation);
$rel = $query;
while(!empty($parts)) {
$rel = $rel->getRelation(array_shift($parts));
}
Then it will be able to resolve the nested relations
We just upgraded to v2.0 recently and got bit by this issue :(
Thank you @TitasGailius!
Nice package! 😊
Trying out your package, I found that nested relationship search is broken in 2.0.0, as it returns
Call to undefined relationship [user.country]
now.Works in 1.0.6 though.