Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

Request::has('fields') 

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.

like image 591
Life4Cali Avatar asked Feb 09 '15 16:02

Life4Cali


1 Answers

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

use Illuminate\Support\Facades\Request; 
like image 142
lukasgeiter Avatar answered Sep 25 '22 13:09

lukasgeiter