EN ES
Home > Web development > Laravel Tutorials > Laravel 5 Non Static Method Request::ajax() Should Not Be Called Statically

Laravel 5 Non Static Method Request::ajax() Should Not Be Called Statically

Diego Cortés
Diego Cortés
September 7, 2016
Laravel 5 Non Static Method Request::ajax() Should Not Be Called Statically

Hello everyone, today we will see how to solve the following error when using Request::ajax() to verify that the request is via ajax, the error is the following:

Non-static method Illuminate\Http\Request::ajax() should not be called statically

Solution:

The solution is very easy! Simply within our controller that we are using we must replace the line:

use Illuminate\Http\Request

by:

use Request;

Now it should work perfectly, at least for me :D, I hope it helps more than one.

Diego Cortés
Diego Cortés
Full Stack Developer, SEO Specialist with Expertise in Laravel & Vue.js and 3D Generalist

Categories

Page loaded in 30.49 ms