mirror of
https://github.com/flarum/core.git
synced 2025-07-25 10:41:24 +02:00
Don't load a custom relation if the relation is already loaded
This commit is contained in:
@@ -77,7 +77,7 @@ abstract class Model extends Eloquent
|
|||||||
// If a custom relation with this key has been set up, then we will load
|
// If a custom relation with this key has been set up, then we will load
|
||||||
// and return results from the query and hydrate the relationship's
|
// and return results from the query and hydrate the relationship's
|
||||||
// value on the "relationships" array.
|
// value on the "relationships" array.
|
||||||
if ($relation = $this->getCustomRelation($key)) {
|
if (! $this->relationLoaded($key) && ($relation = $this->getCustomRelation($key))) {
|
||||||
if (! $relation instanceof Relation) {
|
if (! $relation instanceof Relation) {
|
||||||
throw new LogicException('Relationship method must return an object of type '
|
throw new LogicException('Relationship method must return an object of type '
|
||||||
. 'Illuminate\Database\Eloquent\Relations\Relation');
|
. 'Illuminate\Database\Eloquent\Relations\Relation');
|
||||||
|
Reference in New Issue
Block a user