i want to sum of amount by currency wise
i do in sql like this
select sum(total),currencies.currency_symbol from invoices
join(currencies)
where(invoices.currency_id = currencies.id)
group by(currency_id)
i tried in laravel like this
$sum = Invoice::sum('total')
->select('currency_symbol')
->join('currencies','invoices.currency_id','=','currencies.id')
->groupBy('currency_id');
return response()->json($sum);
But it throws an error
Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function select() on string
please give me solution
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire