Hi, I guess you need 2 queries:
- The first one to calculate the nearest date:
->orderByRaw('ABS(DATEDIFF(expiry, today()->format("Y-m-d")))')->first() - From this you can extract the date, and with a second query you can get the corresponding records.
As of writing this, I am sure, you can do this in one query... perhaps I can manage that today...
cheers Stefan