hi i have a when eloquent clause that i want to pick only the properties that has active relation of discount so my code is like below :
->when($has_discount, function ($query, $has_discount) {
$query->with([
'accommodationRoomsLimited' => function ($q) use ($has_discount) {
$q->has('discount');
}
]);
i will go for my hotels and then inside that i pick rooms and i want to pick hotels with active relation of discount on room but this code right now is doing nothing for me how can i achive that ??