I have two tables
1. users (id,name, address) 1,abc,address1 2,xyz,address2 2. books (id,user_id,book,price) 1,1,book1,10 2,2,book1,10 3,1,book2,15 4,1,book3,20 When I run Eloquent query like this
User::with('books') ->withCount('books') ->wherein('id',[1,2])->get(); It give me result of count each user under books
Relationship is done properly.
What I want is 1. total count of all user books 2. total sum of price for all user
how can I do that in Eloquent
Thanks