MySQL选择日期等于Laravel 5.2中的今天

时间:2016-08-08 07:35:32

标签: mysql laravel-5.2

我有以下代码来获取其术语今天结束的客户。

$customers = CompanyModel::where(("term_ending") ,"=", "CURDATE()")->get();

但是当我运行它时它返回null。

我在Mysql中运行的相同查询它给了我结果。

select * from `companies` where `term_ending` = CURDATE()

我在做什么错?

1 个答案:

答案 0 :(得分:0)

我用碳来解决它。

$ customers = CompanyModel :: where((" term_ending")," =",Carbon :: today()) - > get();

谢谢:)