You can install the package using composer
$ composer require tequilarapido/restrict-access
- Add service provider
Tequilarapido\RestrictAccess\ServiceProvider::class,
- Add middlewares to kernel
protected $routeMiddleware = [
'restrict_access_by_ip' => RestrictAccessByIp::class,
'restrict_access_by_basic_auth' => RestrictAccessByBasicAuthentication::class,
];
-
Add middleware to routes on witch you need to restrict access
-
Env file
RESTRICT_ACCESS_BY_BASIC_AUTH_ENABLED=true
RESTRICT_ACCESS_BY_BASIC_AUTH_usename=username
RESTRICT_ACCESS_BY_BASIC_AUTH_password=password
RESTRICT_ACCESS_BY_IP_ENABLED=false
RESTRICT_ACCESS_BY_IP_ENABLED_EXCEPT=a,b,c
The MIT License (MIT). Please see License File for more information.