public function orderTotal($orderId)
 {
     $items = OrderItem::where('order_id', '=', $orderId)->get();
     $total = 0;
     foreach ($items as $item) {
         $total += $item->quantity * $item->price;
     }
     return $total;
 }
 public function download($orderId, $filename)
 {
     $fileid = \App\File::where('filename', $filename)->first();
     $orderItem = OrderItem::where('order_id', '=', $orderId)->where('file_id', $fileid->id)->first();
     if (!$orderItem) {
         redirect('/failed');
     }
     $entry = \App\File::where('filename', $filename)->first();
     $file = Storage::disk('local')->get($entry->filename);
     return (new Response($file, 200))->header('Content-Type', $entry->mime);
 }
Beispiel #3
0
 public function show($id)
 {
     $orderItems = OrderItem::where('order_id', $id)->get();
     return view('order.show', compact('orderItems'));
 }
 public function getOrderItems($orderId)
 {
     return OrderItem::where('order_id', $orderId)->get();
 }
Beispiel #5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $order = Order::findOrFail($id);
     $order_item = OrderItem::where('order_id', $id)->get();
     //오더 아이템의 갯수만큼 텍스트 박스를 늘려서, 값을 넣어야한다.
     $customer = Customer::where('order_relationship', $id)->first();
     if ($customer == null) {
         $customer_name = substr($order->customer_name, 0, 6);
         $customer = Customer::where('first_name', 'LIKE', "%{$customer_name}%")->first();
     }
     // 여기를 contact_number로 변경하고 없
     //$customer = Customer::where('first_name','LIKE',"%$customer_name%")->get();
     /* product_name 컬럼안의 갯수만큼 배열 변수를 만들어야한다. */
     //$order->product_name_arr = explode(",",$order->product_name);
     //갯수를 구한다.
     //dd($order->product_name_arr);
     return view('order.edit', compact('order', 'customer', 'order_item'));
 }