From bda5120e9a942ee0de7867d0516d0378ea5bdcd7 Mon Sep 17 00:00:00 2001 From: Jeppe Knockaert Date: Wed, 14 Feb 2018 12:06:34 +0100 Subject: [PATCH 1/2] Add morphedByMany relationship --- src/Console/ModelsCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 7359a84..4b7aa5b 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -460,7 +460,8 @@ class ModelsCommand extends Command 'morphOne', 'morphTo', 'morphMany', - 'morphToMany' + 'morphToMany', + 'morphedByMany' ) as $relation) { $search = '$this->' . $relation . '('; if ($pos = stripos($code, $search)) { @@ -470,7 +471,7 @@ class ModelsCommand extends Command if ($relationObj instanceof Relation) { $relatedModel = '\\' . get_class($relationObj->getRelated()); - $relations = ['hasManyThrough', 'belongsToMany', 'hasMany', 'morphMany', 'morphToMany']; + $relations = ['hasManyThrough', 'belongsToMany', 'hasMany', 'morphMany', 'morphToMany', 'morphedByMany']; if (in_array($relation, $relations)) { //Collection or array of models (because Collection is Arrayable) $this->setProperty( From 17982029f06cb229829332599148dc792b4fb7b7 Mon Sep 17 00:00:00 2001 From: Jeppe Knockaert Date: Wed, 14 Feb 2018 12:15:38 +0100 Subject: [PATCH 2/2] Move long one-line array to multiple lines --- src/Console/ModelsCommand.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 4b7aa5b..91f9886 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -471,7 +471,14 @@ class ModelsCommand extends Command if ($relationObj instanceof Relation) { $relatedModel = '\\' . get_class($relationObj->getRelated()); - $relations = ['hasManyThrough', 'belongsToMany', 'hasMany', 'morphMany', 'morphToMany', 'morphedByMany']; + $relations = [ + 'hasManyThrough', + 'belongsToMany', + 'hasMany', + 'morphMany', + 'morphToMany', + 'morphedByMany', + ]; if (in_array($relation, $relations)) { //Collection or array of models (because Collection is Arrayable) $this->setProperty(