Reputation: 453
I'm using laravel and I'm trying to grab all my items where the started_at is greater then 5 minutes and my completed_at is null. I should be getting some items but I'm just getting an empty array, so I'm hoping maybe someone can check my query out for me.
Here is my query
$items = Item::where('started_at', '>' Carbon::parse('started_at)->addMinutes(5))
->whereNull('completed_at)
->get()
Upvotes: 0
Views: 379
Reputation: 12845
$items = Item::where('started_at', '<' now()->subMinitues(5))
->whereNull('completed_at)
->get();
where('started_at', '<' now()->subMinitues(5))
mean that it has been more than 5 minutes since started_at
- is my understanding correct - that's what you intend
Upvotes: 1