Conditions | 3 |
Paths | 1 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function handle() |
||
39 | { |
||
40 | $now = Carbon::now(config('app.timezone')); |
||
41 | |||
42 | $ip = config('firewall.models.ip', Ip::class); |
||
43 | $ip::with('log')->blocked()->each(function ($ip) use ($now) { |
||
44 | if (empty($ip->log)) { |
||
45 | return; |
||
46 | } |
||
47 | |||
48 | $period = config('firewall.middleware.' . $ip->log->middleware . '.auto_block.period'); |
||
49 | |||
50 | if ($ip->created_at->addSeconds($period) > $now) { |
||
51 | return; |
||
52 | } |
||
53 | |||
54 | $ip->logs()->delete(); |
||
55 | $ip->delete(); |
||
56 | }); |
||
57 | } |
||
58 | } |
||
59 |