Why I'm getting htmlenties() error

Posted 2 years ago by Khudadad

I'm trying to display sum of a column but getting this error:

    htmlentities() expects parameter 1 to be string, object given

This is my code in the controller:

    $purchase = DB::table('purchases')
        ->join('currencies', 'currencies.cur_id', '=', 'purchases.currency_id')
        ->selectRaw('purchases.*, currencies.currency ,SUM(purchases.quantity*unit_price) as total, SUM(purchases.c_price*quantity) as usd_total')
        ->first();

And the View:

    {{ number_format($purchase->usd_total,2) }}

any help.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.