mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
fix: skip resource eager loading if manually eager loaded
This commit is contained in:
@@ -98,7 +98,9 @@ abstract class AbstractDatabaseResource extends AbstractResource implements
|
|||||||
EloquentBuffer::add($model, $relationName, $aggregate);
|
EloquentBuffer::add($model, $relationName, $aggregate);
|
||||||
|
|
||||||
return function () use ($model, $relationName, $relationship, $field, $context, $aggregate) {
|
return function () use ($model, $relationName, $relationship, $field, $context, $aggregate) {
|
||||||
EloquentBuffer::load($model, $relationName, $relationship, $context, $aggregate);
|
if (! $model->hasAttribute($this->property($field))) {
|
||||||
|
EloquentBuffer::load($model, $relationName, $relationship, $context, $aggregate);
|
||||||
|
}
|
||||||
|
|
||||||
return $model->getAttribute($this->property($field));
|
return $model->getAttribute($this->property($field));
|
||||||
};
|
};
|
||||||
@@ -140,7 +142,9 @@ abstract class AbstractDatabaseResource extends AbstractResource implements
|
|||||||
EloquentBuffer::add($model, $method);
|
EloquentBuffer::add($model, $method);
|
||||||
|
|
||||||
return function () use ($model, $method, $field, $context) {
|
return function () use ($model, $method, $field, $context) {
|
||||||
EloquentBuffer::load($model, $method, $field, $context);
|
if (! $model->relationLoaded($method)) {
|
||||||
|
EloquentBuffer::load($model, $method, $field, $context);
|
||||||
|
}
|
||||||
|
|
||||||
$data = $model->getRelation($method);
|
$data = $model->getRelation($method);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user