简体   繁体   English

选择自在 laravel 中创建以来超过 24 小时的模型

[英]select models that more than 24 hours have passed since their creation in laravel

I think that question title is Self-Descriptive.我认为这个问题的标题是自我描述的。

In fact I want to select all rows that more than 24 have passed since their created_at attribute in laravel with Carbon and where clauses .事实上,我想选择所有超过 24的行,因为它们在 laravel 中的created_at属性与Carbonwhere 子句一起传递。

$question = Question::where('created_at',/* what do I here*/);

How can I do that ?我怎样才能做到这一点 ?

Try this:尝试这个:

$question = Question::where('created_at', '>=', Carbon::now()->subDay())->get();

Description 描述

$question = Question::where('created_at', date("Y-m-d H:i:s",strtotime("22-11-2016"."-1 day")));
Question::where('created_at', '<', now()->subHours(24));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM