Skip to content
Advertisement

Laravel Carbon usage

I have a query.So when i try get data from database,it show me null.

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

Advertisement

Answer

Can you try with “whereDate” method ?

For example:

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

You can find more documentation here: https://laravel.com/docs/8.x/queries

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement