timgavin
1149
4
Eloquent

count(): Parameter must be an array or an object that implements Countable

Posted 4 months ago by timgavin

I'm using Laravel 5.7 and PHP 7.3.3, both in production and locally using Valet. However, in production I'm receiving the error count(): Parameter must be an array or an object that implements Countable

Here's my query.

$users = \App\User::whereDate('created_at', \Carbon\Carbon::today())->count();

I've read that this was an issue in PHP 7.2, and that the solution was to upgrade to Laravel 5.6. I'm past that; why am I receiving this error and how do I fix it?

Please sign in or create an account to participate in this conversation.