Reputation: 37
Is there an equivalent query for this in eloquent?
SELECT DISTINCT agent_code,ord_amount FROM orders
Upvotes: 0
Views: 4578
Reputation: 2834
Try to use this eloquent query:
$orders = Order::select('agent_code', 'ord_amount')->distinct()->orderBy('agent_code')->get();
Upvotes: 0
Reputation: 2730
Try something like this:
Order::select('agent_code', 'ord_amount')->distinct()->get();
Upvotes: 1