$today = Carbon::now();
$page = Event::where('slug', $slug)->whereDate('active_from', '>=', $today)->first();
Nov 4, 2022
6
Level 10
Stuck with Eloquent Date where() clause
Hi all,
I bet it is stupid to solve but I am actually stuck.
I am trying to run this:
$today = Carbon::now();
logger($today); // 2022-11-04 15:19:49
$page = Event::where('slug', $slug)->where('active_from', '>=', $today)->first();
The where clause is not working when I add "'>=' , $today" It seems that this date:
2022-11-04 15:19:49
Is not being accepted in the where clause.
The column 'active_from' has the date time registered as(which seems to be the same format):
2022-11-07 14:43:00
I should get a result but receive NULL each time, unless I remove this where clause.
Any idea why please?
Thank you
Please or to participate in this conversation.