If you're performing whereDate()
and check today's records, you can use Carbon's now()
and it will automatically be transformed to date. No need to do ->toDateString()
.
1// Instead of2$todayUsers = User::whereDate('created_at', now()->toDateString())->get();3// No need to convert, just use now()4$todayUsers = User::whereDate('created_at', now())->get();