ecbello's avatar

Chunking my query does not eager load my relashionships.

This is a very simplified version of my code, but as shown below, the relationship for my eager load is coming back null. Does anyone have an idea why?

// $line->order is null
OrderLine::with([ 'purchasable', 'order' ])->chunk(10, fn ($line) => $lines->first()->order)

The code snippet might not be exactly right I typed up quickly but that's the general idea.

0 likes
1 reply

Please or to participate in this conversation.