From ba28841870d3ab61f773cc527cadb824d8fa563a Mon Sep 17 00:00:00 2001 From: Huy Dang Date: Tue, 22 May 2018 13:26:27 +0700 Subject: [PATCH] fix case relation method has parameter --- src/Console/ModelsCommand.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index ad575ca..c6ace3d 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -476,6 +476,11 @@ class ModelsCommand extends Command $search = '$this->' . $relation . '('; if ($pos = stripos($code, $search)) { //Resolve the relation's model to a Relation object. + $methodReflection = new \ReflectionMethod($model, $method); + if ($methodReflection->getNumberOfParameters()) { + return; + } + $relationObj = $model->$method(); if ($relationObj instanceof Relation) {