Add morphedByMany relationship

This commit is contained in:
Jeppe Knockaert
2018-02-14 12:06:45 +01:00
parent b644e48801
commit bda5120e9a
+3 -2
View File
@@ -460,7 +460,8 @@ class ModelsCommand extends Command
'morphOne', 'morphOne',
'morphTo', 'morphTo',
'morphMany', 'morphMany',
'morphToMany' 'morphToMany',
'morphedByMany'
) as $relation) { ) as $relation) {
$search = '$this->' . $relation . '('; $search = '$this->' . $relation . '(';
if ($pos = stripos($code, $search)) { if ($pos = stripos($code, $search)) {
@@ -470,7 +471,7 @@ class ModelsCommand extends Command
if ($relationObj instanceof Relation) { if ($relationObj instanceof Relation) {
$relatedModel = '\\' . get_class($relationObj->getRelated()); $relatedModel = '\\' . get_class($relationObj->getRelated());
$relations = ['hasManyThrough', 'belongsToMany', 'hasMany', 'morphMany', 'morphToMany']; $relations = ['hasManyThrough', 'belongsToMany', 'hasMany', 'morphMany', 'morphToMany', 'morphedByMany'];
if (in_array($relation, $relations)) { if (in_array($relation, $relations)) {
//Collection or array of models (because Collection is Arrayable) //Collection or array of models (because Collection is Arrayable)
$this->setProperty( $this->setProperty(