jeudi 19 septembre 2019

Not able to output "total registrations today" count

I am trying to output the count of total registrations today, registrations in the last 7 days, last 30 days.

All the other counts are output as expected. Except for registrations today.

$registration_summery = ['Registrations today' => '+0 days', 'Registrations in the last 7 Days'   => '-7 days',
    'Registrations in the last 15 Days'                 => '-15 days', 'Registrations in the last 30 Days' => '-30 days',
    'Registrations in the last 6 month'                 => '-6 months', 'Registrations in the last 1 year' => '-1 Years'];

$toReturn['registration_summery'][] = ['name' => 'Total Learners', 'value' => \DB::table('users')->where('users.role', 'student')->count()];
foreach ($registration_summery as $key => $value) {
    $tmp = \DB::table('users')->where('role', 'student')
        ->where('createdAt', '>=', strtotime("tomorrow", strtotime($value)) - 1)
        ->where('createdAt', '<=', strtotime("midnight"))
        ->count();
    $toReturn['registration_summery'][] = ['name' => $key, 'value' => $tmp];
}

No Errors, but the count shows 0



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire