Get count of records created today Laravel

If you are looking to get the total number of records that are created / updated today in the mysql database, then the following Eloquent query will come handy.

Considering we have a model named Post Post

Post::whereDate('created_at', Carbon::today())->count();

Similarly to get count of records which are updated today, you can use the following eloquent query

Post::whereDate('updated_at', Carbon::today())->count();

Site Footer