Maybe the collection helper functions would be helpful?
https://laravel.com/docs/7.x/collections
You could possibly get all of the results for the month, then group them by the day, and then return the min value for the price key?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am saving prices for a product several times every day in a price table.
Now, I would like to collect data for a chart with the lowest prices for each of the past 30 days for one specific product. Is there a way to do this in Eloquent?
I have no other idea than creating a query for each day. But I have the feeling this probably can be done a lot better.
Any idea?
Please or to participate in this conversation.