This seems very easy query but can't translate it into laravel query. I have table orders
there are two columns total_usd
and total_gbp
. I want to sum each column to get total of usd and total of gbp on the page.
This query is working in phpmyadmin and I got correct result
SELECT sum(order_total_usd) as usd, sum(order_total_gbp) as gbp FROM `orders`
In laravel I've tried this
$sumOrders = Order::select('sum(order_total_gbp) as gbp, sum(order_total_usd) as usd');
when I dd($sumOrders)
I've one really huge output which almost cause browser to freeze.
Where is my mistake here?