Support the ongoing development of →
Database Eloquent
Last updated 7 months ago.

Try moving the with sentence before the where one

Last updated 7 months ago.

The only thing that could be wrong there is the order in this part:

$count = $query->count();
$formatted_date = $date->format('Y-m-d H:i:s');

for the where statement is applied after the count is fired, so your $count holds value ignoring that where. Just swap the two and it may get you the result you need.

Last updated 7 months ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.