laravel-er-diagram-generator icon indicating copy to clipboard operation
laravel-er-diagram-generator copied to clipboard

Reject static methods when searching for model relationships

Open spleenboy opened this issue 2 years ago • 0 comments

This PR includes a fix for an issue encountered when using Scout in Laravel, reported as issue #59.

The problem is that the RelationshipFinder class invokes each public, 0-param method on all of the models found in order to collect relationship information. Scout's Searchable trait includes a destructive, 0-param static method removeAllFromSearch that removes all models from the index.

This fix rejects all static methods from testing for relationships. Since Eloquent relationship information should all be defined as non-static methods, this should not affect current model generation but should help eliminate accidentally calling destructive methods on a model.

spleenboy avatar Jul 21 '21 16:07 spleenboy