Closed lYesterdaYl closed 4 years ago
Still having the same problem on Laravel 7 even after using:
use PragmaRX\Firewall\Firewall;
Error code: Non-static method PragmaRX\Firewall\Firewall::isBlacklisted() should not be called statically
Full controller code:
<?php
namespace App\Http\Controllers;
use PragmaRX\Firewall\Firewall;
class BansController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$blacklisted = Firewall::isBlacklisted('10.0.0.3');
dd($blacklisted);
}
}
Just add directory Facades in vendor/pragmarx/firewall/src/
add File Firewall.php
<?php
namespace PragmaRX\Firewall\Facades;
use Illuminate\Support\Facades\Facade;
class Firewall extends Facade
{
/**
* The IoC key accessor.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'firewall';
}
}
this worked for me. Dont forget to add it to config/app.php 'Firewall' => PragmaRX\Firewall\Vendor\Laravel\Facade::class, PragmaRX\Firewall\Vendor\Laravel\ServiceProvider::class,
Using Laravel 5.7, properly installed the package. Run php artisan firewall:list works fine, but when I try this in the controller. Not working.
Non-static method PragmaRX\Firewall\Firewall::remove() should not be called statically.
Not sure how I should call this method. Help please.