1. Go to this page and download the library: Download pragmarx/firewall library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* Route notifications for the Slack channel.
*
* @return string
*/
public function routeNotificationForSlack()
{
return config('services.slack.webhook_url');
}
$whitelisted = Firewall::isWhitelisted('10.17.12.1');
$blacklisted = Firewall::isBlacklisted('10.0.0.3');
Firewall::whitelist('192.168.1.1');
Firewall::blacklist('10.17.12.1', true); /// true = force in case IP is whitelisted
Firewall::blacklist('127.0.0.0-127.0.0.255');
Firewall::blacklist('200.212.331.0/28');
Firewall::blacklist('country:br');
if (Firewall::whichList($ip) !== false) // returns false, 'whitelist' or 'blacklist'
{
Firewall::remove($ip);
}
Route::group(['middleware' => 'fw-block-blacklisted'], function ()
{
Route::get('/', 'HomeController@index');
});
Route::group(['middleware' => 'fw-block-blacklisted'], function ()
{
Route::get('coming/soon', function()
{
return "We are about to launch, please come back in a few days.";
});
Route::group(['middleware' => 'fw-only-whitelisted'], function ()
{
Route::get('/', 'HomeController@index');
});
});