If start is a datetimeor timestamp field, doesn't this work?
return $query->where('start', '<', Carbon::now()) ->orderBy('starts', 'desc') ->limit($limit);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I have a query such as
return $query->whereDate('start', '<', Carbon::now()) ->orderBy('starts', 'desc') ->limit($limit);
Obviously this is just ignoring 'times' - the 'start' is a Database carbon dateTime field.
Does anybody know how If there is anything for including the time in the query? I know there is a whereTime() - but obviously it will still return wrong results because of the whereDate() query.
Any idea? no doubt its super easy, just having a brain lapse. So thought Id reach out for help.
Cheers David
Please or to participate in this conversation.