-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Needs investigationNeed investigation about bugs described in issueNeed investigation about bugs described in issuebugrelationsRelations between documentsRelations between documents
Description
Hello. I have a problem with withTrashed in MorphTo relation. (Embed model) withTrashed not disable the global scope, and I cannot get the deleted records. I have a workaround, tell me if there is a better way.
To replace it (jenssegers/mongodb/src/Jenssegers/Mongodb/Relations/MorphTo.php)
protected function getResultsByType($type)
{
$instance = $this->createModelByType($type);
$key = $instance->getKeyName();
$query = $instance->newQuery();
return $query->whereIn($key, $this->gatherKeysByType($type))->get();
}
On
protected function getResultsByType($type)
{
$instance = $this->createModelByType($type);
$key = $instance->getKeyName();
$query = $this->replayMacros($instance->newQuery())
->mergeConstraintsFrom($this->getQuery())
->with($this->getQuery()->getEagerLoads());
return $query->whereIn($key, $this->gatherKeysByType($type))->get();
}
jesus6402artemtaranov and jesus6402
Metadata
Metadata
Assignees
Labels
Needs investigationNeed investigation about bugs described in issueNeed investigation about bugs described in issuebugrelationsRelations between documentsRelations between documents