perhaps 2 queries might be simplest.
first get your max, eg 3, and then in a separate query, get all records where the number is 3
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
normally to fetch latest record i use desc order and use limit, but now i want multiple records for the latest date or max number, So if a column has maxiumum number e-g 3, and there are multiple records with this max number, so i want to fetch all those records with this max number.
i tried using max(), but it returns me the 3 integer number not the records its self.
Any idea how i can fetch records for latest number or maximum number in database using laravel eloquent?
Please or to participate in this conversation.