You can't limit eager load for list.
Meybe something like this?
Account::with(
[
'transactions' => function ($comment) {
$comment->where('created_at', '<=', '1999-12-21');
}
]
)->get();
Or you can perform standard query with join to get all (last 3 transaction ids) and inject to with scope
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community