Skip to content

Commit

Permalink
Fix issue #596
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Sep 24, 2015
1 parent 9737b9b commit e234d93
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Jenssegers/Mongodb/Eloquent/HybridRelations.php
Expand Up @@ -22,7 +22,7 @@ trait HybridRelations {
public function hasOne($related, $foreignKey = null, $localKey = null)
{
// Check if it is a relation with an original model.
if ($related instanceof Model)
if (! is_subclass_of($related, 'Jenssegers\Mongodb\Model'))
{
return parent::hasOne($related, $foreignKey, $localKey);
}
Expand All @@ -49,7 +49,7 @@ public function hasOne($related, $foreignKey = null, $localKey = null)
public function morphOne($related, $name, $type = null, $id = null, $localKey = null)
{
// Check if it is a relation with an original model.
if ($related instanceof Model)
if (! is_subclass_of($related, 'Jenssegers\Mongodb\Model'))
{
return parent::morphOne($related, $name, $type, $id, $localKey );
}
Expand All @@ -76,7 +76,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey =
public function hasMany($related, $foreignKey = null, $localKey = null)
{
// Check if it is a relation with an original model.
if ($related instanceof Model)
if (! is_subclass_of($related, 'Jenssegers\Mongodb\Model'))
{
return parent::hasMany($related, $foreignKey, $localKey);
}
Expand All @@ -103,7 +103,7 @@ public function hasMany($related, $foreignKey = null, $localKey = null)
public function morphMany($related, $name, $type = null, $id = null, $localKey = null)
{
// Check if it is a relation with an original model.
if ($related instanceof Model)
if (! is_subclass_of($related, 'Jenssegers\Mongodb\Model'))
{
return parent::morphMany($related, $name, $type, $id, $localKey);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
}

// Check if it is a relation with an original model.
if ($related instanceof Model)
if (! is_subclass_of($related, 'Jenssegers\Mongodb\Model'))
{
return parent::belongsTo($related, $foreignKey, $otherKey, $relation);
}
Expand Down Expand Up @@ -235,7 +235,7 @@ public function belongsToMany($related, $collection = null, $foreignKey = null,
}

// Check if it is a relation with an original model.
if ($related instanceof Model)
if (! is_subclass_of($related, 'Jenssegers\Mongodb\Model'))
{
return parent::belongsToMany($related, $collection, $foreignKey, $otherKey, $relation);
}
Expand Down

0 comments on commit e234d93

Please sign in to comment.