Answer the question
In order to leave comments, you need to log in
How to build such a query using eloquent?
select * from `orders` where (exists (select * from `repairs` where orders.id = repairs.order_id and repairs.prepayment >= repairs.total * 0.5))
Order::whereHas('repairs' ,function ($query){
$query->where('repairs.prepayment', '>=', 'repairs.total * 0.5');
})->get();
$query->whereRaw('repairs.prepayment >= repairs.total * 0.5'); //так тоже пробовал
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question