Unverified Commit 5b42dcc1 authored by Stephan de Souza's avatar Stephan de Souza Committed by GitHub

HybridRelations::morphTo() needs to respect $ownerKey

Actually is forced to use `_id`
parent 2d76d22a
......@@ -184,7 +184,7 @@ trait HybridRelations
// there are multiple types in the morph and we can't use single queries.
if (($class = $this->$type) === null) {
return new MorphTo(
$this->newQuery(), $this, $id, null, $type, $name
$this->newQuery(), $this, $id, $ownerKey, $type, $name
);
}
......@@ -195,8 +195,10 @@ trait HybridRelations
$instance = new $class;
$ownerKey = $ownerKey ?? $instance->getKeyName();
return new MorphTo(
$instance->newQuery(), $this, $id, $instance->getKeyName(), $type, $name
$instance->newQuery(), $this, $id, $ownerKey, $type, $name
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment