1
I have a query that when passing to eloquent returns me syntax error.
SELECT order_id FROM timelines
WHERE order_id NOT IN (SELECT order_id FROM timelines WHERE supplier_approved_id) AND supplier_id = 2
GROUP BY order_id
Eloquent:
Timeline::select('order_id')
->whereRaw('order_id NOT IN', [], '( SELECT order_id FROM timelines WHERE supplier_approved_id )')
->where('supplier_id', 2)
->groupBy('order_id')
->get();
Instead of getting to use toSql() in Eloquent, this will return the SQL mounted by Eloquent, then you compare it to your query above and see what’s wrong.
– Kayo Bruno