本文整理匯總了PHP中app\Item::WhereIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::WhereIn方法的具體用法?PHP Item::WhereIn怎麽用?PHP Item::WhereIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Item
的用法示例。
在下文中一共展示了Item::WhereIn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getWeeklyItems
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"]);
}
示例2: getMainCardCategoryAndItems
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]);
}
}