Cleanup   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 43
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 12 1
1
<?php
2
3
namespace Soved\Laravel\Gdpr\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupJob;
7
8
class Cleanup extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'gdpr:cleanup';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Cleanup inactive users';
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
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
        $config = config('gdpr');
42
43
        $userModel = config('auth.providers.users.model');
44
        $users = $userModel::all();
45
46
        $strategy = app($config['cleanup']['strategy']);
47
48
        CleanupJob::dispatch($users, $strategy);
49
50
        $this->info('CleanupJob dispatched');
51
    }
52
}
53