I have weird case, i have simple polls with hasMany questions resources. Questions resource also have self reference for parent question (enabledIfQuestion).
When i try to GET /api/polls/{id}?include=questions,questions.enabledIfQuestion everything works fine, but, when i define questions relationship in Poll model with ->orderBy(), like that:
public function questions(): HasMany
{
return $this->hasMany(PollQuestion::class)->orderBy('order');
}
then, in response, some (but not all) records has missing relationships in included section.
Hi,
I have weird case, i have simple
polls
with hasManyquestions
resources. Questions resource also have self reference for parent question (enabledIfQuestion
).When i try to
GET /api/polls/{id}?include=questions,questions.enabledIfQuestion
everything works fine, but, when i define questions relationship inPoll
model with->orderBy()
, like that:then, in response, some (but not all) records has missing relationships in included section.
Without order:
With order: