Passed
Push — master ( 48c78c...6f5874 )
by Darko
06:40
created

CollectStats::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 14
rs 9.8666
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Console\Commands;
4
5
use App\Models\DownloadStat;
6
use App\Models\GrabStat;
7
use App\Models\ReleaseStat;
8
use App\Models\RoleStat;
9
use App\Models\SignupStat;
10
use Illuminate\Console\Command;
11
12
class CollectStats extends Command
13
{
14
    /**
15
     * The name and signature of the console command.
16
     *
17
     * @var string
18
     */
19
    protected $signature = 'nntmux:collect-stats';
20
21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Collects and stores various statistics about the site.';
27
28
    /**
29
     * Execute the console command.
30
     */
31
    public function handle()
32
    {
33
        $this->info('Collecting site stats...');
34
        GrabStat::insertTopGrabbers();
35
        $this->info('Top grabbers collected.');
36
        DownloadStat::insertTopDownloads();
37
        $this->info('Top downloads collected.');
38
        ReleaseStat::insertRecentlyAdded();
39
        $this->info('Recently added releases collected.');
40
        SignupStat::insertUsersByMonth();
41
        $this->info('New users by month collected.');
42
        RoleStat::insertUsersByRole();
43
        $this->info('Users by role collected.');
44
        $this->info('Site stats collected.');
45
    }
46
}
47