public function getItems(Request $request) { $items = OrderItem::with('product')->where('order_id', $request->get('order_id'))->get(); return json_encode($items); }
protected function saveOrderItem($producto, $order_id) { OrderItem::create(['price' => $producto->price, 'quantity' => 1, 'product_id' => $producto->id, 'order_id' => $order_id]); }