Kenan Hj
Kenan Hj

Reputation: 15

How desplay the number from the Code in blade Laravel

Show only the variable number in the blade from the $sum value

In Blade:

{{$sum}}

In controller:

$sum = OrderPosition::select(DB::raw('sum(quantity*product_price) AS total_sales'))->where('quantity', '<>', 1)->get();

the output is {"total_sales":"550.00"}

Upvotes: 0

Views: 23

Answers (1)

Vikash Pathak
Vikash Pathak

Reputation: 3562

You are trying to display the object. Try this in blade

{{$sum->total_sales}}

Upvotes: 1

Related Questions