📜  laravel 查询 foreach - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:44.698000             🧑  作者: Mango

代码示例1
$listing = Listing:where('id', $id);
foreach ($input as $key => $value) {
     $i++;
     // ->where('field_1', red_1); // Desired output
     $listing->where("where(field_{$i},".$value."_1)");
}
$results = $listing->get();