Example #1
0
 public function saveOrderItem($product, $order_id)
 {
     OrderItem::create(['price' => $product->price, 'quantity' => $product->quantity, 'product_id' => $product->id, 'order_id' => $order_id]);
 }
 public function detail(Request $request)
 {
     $order_id = $request->get('order_id');
     $items = OrderItem::with('product')->where('order_id', $order_id)->get();
     return json_decode($items);
 }