Skip to content

Instantly share code, notes, and snippets.

@cesargb
Created April 28, 2018 14:00
Show Gist options
  • Save cesargb/a36e40c9bd41d547e08ce38f86a960e8 to your computer and use it in GitHub Desktop.
Save cesargb/a36e40c9bd41d547e08ce38f86a960e8 to your computer and use it in GitHub Desktop.
Laravel LiteFirewall
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\IpUtils;
class Firewall
{
public function handle($request, Closure $next, $netwoks)
{
$netwoks = is_array($netwoks)
? $netwoks
: explode('|', $netwoks);
if (IpUtils::checkIp($request->ip(), $netwoks)) {
return $next($request);
} else {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment