Conditions | 2 |
Paths | 2 |
Total Lines | 5 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public static function insertUsersByMonth(): void |
||
15 | { |
||
16 | $users = User::query()->whereNotNull('created_at')->where('created_at', '<>', '0000-00-00 00:00:00')->selectRaw("DATE_FORMAT(created_at, '%M %Y') as mth, COUNT(id) as num")->groupBy(['mth'])->orderByDesc('created_at')->get(); |
||
17 | foreach ($users as $user) { |
||
18 | self::updateOrCreate(['month' => $user->mth], ['signups' => $user->num]); |
||
19 | } |
||
27 |