using foreach in eloquent query laravel code example
Example: laravel query foreach
$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();