I want to run the below query
SELECT * FROM order_item JOIN order ON (order_item.order_id = order.id AND order.order_status IN ('payment_completed','refund_requested')) WHERE order_item.item_id=1;
I tried like below.
OrderItem::join('order', function($join){
$join->on('order.id','=','order_item.order_id');
$join->whereIn('order.order_status',array('payment_completed','refund_requested'));
})->where('order_item.item_id','=','1')->get();
I know this is wrong. What is the right way to use whereIn clause in join condition?
Thanks in advance!
Hell, I have another option for do this thing.
You can use FIND_IN_SET('ABC','ABC,CDE,DEF,XYZ');
It will return true if condition true so you can add this condition in join cause.