Completed
Pull Request — master (#16)
by Miguel
02:52
created

CleanupCommand::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Clarkeash\Doorman\Commands;
4
5
use Illuminate\Console\Command;
6
use Clarkeash\Doorman\Models\Invite;
7
8
class CleanupCommand extends Command
9
{
10
    /**
11
     * The console command signature.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'doorman:cleanup';
16
    
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Remove expired invites from the database.';
23
    
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
    }
33
    
34
    /**
35
     * Execute the console command.
36
     *
37
     * @return mixed
38
     */
39
    public function handle()
40
    {
41
        $useless = Invite::useless()->count();
42
        Invite::useless()->delete();
43
        $this->info('Successfully deleted '.$useless.' expired invites from the database.');
44
    }
45
}
46