public function checkOff($id) { $item = ShoppingList::find($id); $item->checked = true; $item->save(); return ['ok']; }
/** * Shows list page. * * @param $id, the id of the list * @return Response, a view for showing a specific list page. */ public function getList($date) { $res = DB::table('daylist')->where('day', '=', $date)->get(); $lists = $listIDs = []; foreach ($res as $r) { $list = ShoppingList::find($r->list); $listIDs[] = $r->list; $lists[] = $list; $list->products()->orderBy('status')->orderBy('name')->get(); } $products = Product::whereIn('list', $listIDs)->orderBy('status')->orderBy('name')->get(); return view('shop.list')->with('date', $date)->with('lists', $lists)->with('products', $products); }
public function getShow($id) { $list = ShoppingList::find($id); $products = $list->products()->orderBy('status')->orderBy('name')->get(); return response()->json($products); }
public function postSettings(Request $request) { $list = ShoppingList::find($request->input('id')); $list->budget = $request->input('budget'); $list->name = $request->input('name'); $list->eventdate = $request->input('eventdate'); $list->save(); return redirect('list/show/' . $list->id)->with('success', 'Listan uppdaterades.'); }