检查 started_at 是否大于 5 分钟
Checking to see if started_at is greater then 5 minutes
我正在使用 laravel,我正在尝试获取 started_at 大于 5 分钟且我的 completed_at 为空的所有项目。我应该得到一些项目,但我只是得到一个空数组,所以我希望有人可以帮我检查我的查询。
这是我的查询
$items = Item::where('started_at', '>' Carbon::parse('started_at)->addMinutes(5))
->whereNull('completed_at)
->get()
$items = Item::where('started_at', '<' now()->subMinitues(5))
->whereNull('completed_at)
->get();
where('started_at', '<' now()->subMinitues(5))
表示距 started_at
已经超过 5 分钟 - 我的理解是否正确 - 这就是你想要的
我正在使用 laravel,我正在尝试获取 started_at 大于 5 分钟且我的 completed_at 为空的所有项目。我应该得到一些项目,但我只是得到一个空数组,所以我希望有人可以帮我检查我的查询。
这是我的查询
$items = Item::where('started_at', '>' Carbon::parse('started_at)->addMinutes(5))
->whereNull('completed_at)
->get()
$items = Item::where('started_at', '<' now()->subMinitues(5))
->whereNull('completed_at)
->get();
where('started_at', '<' now()->subMinitues(5))
表示距 started_at
已经超过 5 分钟 - 我的理解是否正确 - 这就是你想要的