예제 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $userid = Auth::id();
     $items = Item::orderBy('item_name', 'asc')->get();
     $editInput = Item::findOrFail($id);
     $skuscan = null;
     $email = User::where('id', $userid)->first()->email;
     $scan = Scan::where('userEmail', $email)->first();
     if ($scan) {
         $skuscan = $scan;
     }
     $totalValue = Item::where('user', $userid)->sum('price');
     $totalQuantity = Item::where('user', $userid)->sum('quantity');
     return view('inventory', compact('items', 'editInput', 'totalValue', 'totalQuantity', 'skuscan'));
 }