Laravel 碳用量

Laravel Carbon usage

我有一个 query.So 当我尝试从数据库中获取数据时,它显示为空。

$heading = DB::table('heading')->where('heading.post_date',Carbon::today())->first();
     

你能试试“whereDate”方法吗?

例如:

$heading = DB::table('heading')->whereDate('heading.post_date', Carbon::today())->first();

您可以在此处找到更多文档:https://laravel.com/docs/8.x/queries