Skip to content

Commit facb5e6

Browse files
authored
Merge pull request #99 from SONGHQ/fix/avoid-destructive-static-methods
Reject static methods when searching for model relationships
2 parents d31e67a + 0370e82 commit facb5e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/RelationFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getModelRelations(string $model)
3131
$methods = Collection::make($class->getMethods(ReflectionMethod::IS_PUBLIC))
3232
->merge($traitMethods)
3333
->reject(function (ReflectionMethod $method) use ($model) {
34-
return $method->class !== $model || $method->getNumberOfParameters() > 0;
34+
return $method->class !== $model || $method->getNumberOfParameters() > 0 || $method->isStatic();;
3535
});
3636

3737
$relations = Collection::make();

0 commit comments

Comments
 (0)