Cleanup::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace mathewparet\LaravelInvites\Commands;
4
5
use mathewparet\LaravelInvites\Models\Invite;
6
7
use Illuminate\Console\Command;
8
9
class Cleanup extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'invites:cleanup';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Remove expired and maximum utilized invitations from DB';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        $count = Invite::useless()->count();
43
        Invite::useless()->delete();
44
        $this->info('Removed './** @scrutinizer ignore-type */ $count.' unusabled invitation codes');
45
    }
46
}
47