X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/307fae39c450f687aba93e589e947e5389357601..refs/pull/5721/head:/app/References/ReferenceFetcher.php diff --git a/app/References/ReferenceFetcher.php b/app/References/ReferenceFetcher.php index 0d9883a3e..1c9664f45 100644 --- a/app/References/ReferenceFetcher.php +++ b/app/References/ReferenceFetcher.php @@ -23,7 +23,7 @@ class ReferenceFetcher public function getReferencesToEntity(Entity $entity): Collection { $references = $this->queryReferencesToEntity($entity)->get(); - $this->mixedEntityListLoader->loadIntoRelations($references->all(), 'from'); + $this->mixedEntityListLoader->loadIntoRelations($references->all(), 'from', true); return $references; } @@ -41,7 +41,8 @@ class ReferenceFetcher { $baseQuery = Reference::query() ->where('to_type', '=', $entity->getMorphClass()) - ->where('to_id', '=', $entity->id); + ->where('to_id', '=', $entity->id) + ->whereHas('from'); return $this->permissions->restrictEntityRelationQuery( $baseQuery,