How to count the total price of order?

前端 未结 3 930
梦如初夏
梦如初夏 2021-01-28 02:25

I have these tables:

Orders: 
id - status -user_id - address_id 
1     await    1          1 

products:
id -  name -   price  - quantity
1     test1    100$             


        
3条回答
  •  忘掉有多难
    2021-01-28 02:55

    Find the sum of a field by using laravel collection by doing something like this;

    $profuctTotal=Product::all()->sum('price'); Do same for others using Eloquent models.

提交回复
热议问题