I don't know if it's possible to do but I want to be able to add to the where conditions dynamically. I think there is a way. I want to be able to send one query instead of multiple queries to the database.
Here's the code I have so far
$elements = NutritionValues::where(function($query) use ($client_id, $products) {
foreach($products as $product) {
$query->where('client_id', '=', $client_id)
->where('product_id', '=', $product['product_id'])
->where('ingredient_name', '=', $product['element_name']);
}
})->get();
return $elements;