public function connectdb($content, $format) { $scanFormat = $format; $scanContent = $content; $user = '******'; $type = 'inventory'; if ($scanFormat && $scanContent != null) { Scan::create(array('userEmail' => $user, 'sku' => $content, 'type' => $type)); } }
/** * 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')); }
/** * Display a listing of the scans. * * @return \Illuminate\Http\Response */ public function index() { $scans = Scan::take(100)->get(); return view('scans.scans', ['scans' => $scans, 'user' => Auth::user()]); }