Filter where date in JSON field - Eloquent

Viewed 607

let's see this screenshot: enter image description here

I have a "dates" field which is a JSON field, array casted in eloquent model.

So, I want to filter rows older or newer than one of the dates listed in this field. I've tried something like this, but it returns empty collection:

$q->where('dates->day', '>=', Carbon::now()->format('Y-m-d'));

Any ideas? Thx!

1 Answers

Check dates->day format

"dates": { "day": "2020-12-12" }

Related