diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index fd6c72b69..fb2106bc1 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -628,7 +628,7 @@ public function getPropertiesFromMethods($model) get_class($model->newModelQuery()) ); $modelName = $this->getClassNameInDestinationFile( - new \ReflectionClass($model), + new ReflectionClass($model), get_class($model) ); $this->setMethod($name, $builder . '|' . $modelName, $args, $comment); @@ -712,10 +712,10 @@ public function getPropertiesFromMethods($model) ) { if ($relationObj instanceof BelongsToMany) { $pivot = get_class($relationObj->newPivot()); - if (!in_array($pivot,[ Pivot::class, MorphPivot::class])) { + if (!in_array($pivot, [Pivot::class, MorphPivot::class])) { $this->setProperty( $relationObj->getPivotAccessor(), - $this->getClassNameInDestinationFile($model,$pivot), + $this->getClassNameInDestinationFile($model, $pivot), true, false ); diff --git a/tests/Console/ModelsCommand/Pivot/Models/ModelWithPivot.php b/tests/Console/ModelsCommand/Pivot/Models/ModelWithPivot.php index f579cf9db..3f9e0bd2c 100644 --- a/tests/Console/ModelsCommand/Pivot/Models/ModelWithPivot.php +++ b/tests/Console/ModelsCommand/Pivot/Models/ModelWithPivot.php @@ -1,5 +1,7 @@