Lazy relations loaded via injected request #212
Replies: 3 comments 2 replies
-
Hi @thewebartisan7 relations: Lazy::whenLoaded('relations', $model, fn () => ModelData::collection($model->relations)),
relationsCount: Lazy::whenLoaded('relations', $model, fn () => $model->relations_count) ? |
Beta Was this translation helpful? Give feedback.
-
Hi @rubenvanassche if (! $this->shouldIncludeProperty($name, $data->{$name}, $trees)) {
return $payload;
} $data->{$name} but I'm not sure, I'm going to test it |
Beta Was this translation helpful? Give feedback.
-
Could you provide me a test which reproduces the problem? Tried this by changing this test (which may be a good starting point): laravel-data/tests/DataTest.php Lines 290 to 303 in 782aced But couldn't reproduce the issue |
Beta Was this translation helpful? Give feedback.
-
Supposely we have
How to avoid loading
relations
when in query we havewithCount('relations')
?Because in my case it load also the
relations
whenwithCount('relations')
is loaded.Beta Was this translation helpful? Give feedback.
All reactions