Laravel Eloquent Sum of relation’s column
I’ve been working on a shopping cart application and now I’ve come to the following issue.. There is a User, a Product and a Cart object. The Cart table only contains the following columns: id, user_id, product_id and timestamps. The UserModel hasMany Carts (because a user can store multiple products). The CartModel belongsTo a User … Read more