fix case relation method has parameter

This commit is contained in:
Huy Dang
2018-05-22 13:26:27 +07:00
parent b02a0bc6c9
commit ba28841870
+5
View File
@@ -476,6 +476,11 @@ class ModelsCommand extends Command
$search = '$this->' . $relation . '('; $search = '$this->' . $relation . '(';
if ($pos = stripos($code, $search)) { if ($pos = stripos($code, $search)) {
//Resolve the relation's model to a Relation object. //Resolve the relation's model to a Relation object.
$methodReflection = new \ReflectionMethod($model, $method);
if ($methodReflection->getNumberOfParameters()) {
return;
}
$relationObj = $model->$method(); $relationObj = $model->$method();
if ($relationObj instanceof Relation) { if ($relationObj instanceof Relation) {