public function getWeeklyItems($location_id, $id) { $allWeeklyMenuItems = WeeklyMenu::Where('menu_id', '=', $id)->lists('item_id'); $allitems = Item::WhereIn('id', $allWeeklyMenuItems)->get(); if (null != $allitems) { return response()->json(["Response" => $allitems]); } return response()->json(["Response", "No record"]); }
public function getMainCardCategoryAndItems($id) { $cats = MaincardCategory::where('location_id', '=', $id)->get(); if ($cats->isEmpty()) { return response()->json(["Response" => "No record"]); } else { $response = array(); foreach ($cats as $categories) { $allItemsid = MainCard::Where('category_id', '=', $categories->id)->lists('item_id'); $allItems = Item::WhereIn('id', $allItemsid)->get(); array_push($response, ["category" => $categories, "items" => $allItems]); } return response()->json(["Response" => $response]); } }