CleanStatisticsRequests::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Statistics\Jobs;
6
7
use Carbon\Carbon;
8
use Illuminate\Bus\Queueable;
9
use Illuminate\Queue\SerializesModels;
10
use Illuminate\Queue\InteractsWithQueue;
11
use Illuminate\Contracts\Queue\ShouldQueue;
12
use Illuminate\Foundation\Bus\Dispatchable;
13
14
class CleanStatisticsRequests implements ShouldQueue
15
{
16
    use Dispatchable;
17
    use InteractsWithQueue;
18
    use Queueable;
19
    use SerializesModels;
20
21
    /**
22
     * Execute the job.
23
     *
24
     * @return void
25
     */
26
    public function handle(): void
27
    {
28
        ! config('rinvex.statistics.lifetime') || app('rinvex.statistics.request')->where('created_at', '<=', Carbon::now()->subDays(config('rinvex.statistics.lifetime')))->delete();
29
    }
30
}
31