Completed
Push — master ( 70e221...24f035 )
by Ashley
02:04
created

CleanupCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 1
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
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function handle()
30
    {
31
        $useless = Invite::useless()->count();
32
        Invite::useless()->delete();
33
        $this->info('Successfully deleted '.$useless.' expired invites from the database.');
34
    }
35
}
36