1
I am trying to bring a JSON result from my database.
$products = DB::table('products')
->join('order_product', 'products.id', '=', 'order_product.product_id')
->select('products.sku', 'products.name', 'order_product.quantity')
->get();
return response()->json($products);
Upshot
What I’m willing to do now is add up the sold amount of each item, as I should do?