Life4Cali Life4Cali - 2 years ago 160
PHP Question

Laravel 5 Illuminate\Http\Request has method not allowing static call

I'm trying to call the Illuminate\Http\Request has method from one of my controllers.


Following from the documentation exactly, yet I'm getting an error thrown:

Non-static method Illuminate\Http\Request::has() should not be called statically, assuming $this from incompatible context

I'm not sure what I'm doing wrong here, I tried following the documentation as closely as possible.

Answer Source

The problem is you are using the wrong Request class. You need to import the Facade:

use Illuminate\Support\Facades\Request;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download