There is my code :
$course = Course::where('id', $activeCourseId)
->with(["blocks.cards" => function($q) use($cardsDueIds) {
$q->whereNotIn('id', $cardsDueIds);
$q->take(50);
},
"blocks.cards.contexts",
"blocks.cards.user_contexts",
"blocks.cards.block.course",
"blocks.cards.thisUser"])
->first();
Course datas are like this :
{
blocks: [
0: {
cards: [
0: {id: 298736},
1: {id: 293747}
]
}
1: {
cards: [
0: {id: 1234445}
]
}
]
}
I try to get the course with only 50 blocks.cards
where blocks.cards.id
are not in the $cardsDueIds
.
Actually it does not work, with take(50)
i get 0 cards and without take(50)
i get all cards (but the whereNotIn doesnt work)...
Anyone know how to do this ? Thanks !