Conditions | 3 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
44 | public function handle($request, Closure $next, ...$allowedIp) |
||
45 | { |
||
46 | $clientIp = $request->server('HTTP_CF_CONNECTING_IP') ?? $request->ip(); |
||
47 | |||
48 | if (!$this->application->environment($this->config->get('ip-middleware.ignore_environments')) && |
||
49 | !in_array($clientIp, Arr::flatten($allowedIp)) |
||
50 | ) { |
||
51 | abort($this->config->get('ip-middleware.error_code')); |
||
52 | } |
||
53 | |||
54 | return $next($request); |
||
55 | } |
||
57 |