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

0 votes

In Laravel, I'm trying to call $input = Request::all(); on a store() method in my controller, but I'm getting the following error:

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

Any help?

Aug 4 in Laravel by kartik
• 27,140 points
155 views

1 answer to this question.

0 votes

Hello @kartik,

The error message is due to the call not going through the Request facade.

Change

use Illuminate\Http\Request;

To

use Request;

and it should start working.

In the config/app.php file, you can find a list of the class aliases. There, you will see that the base class Request has been aliased to the Illuminate\Support\Facades\Request class. Because of this, to use the Request facade in a namespaced file, you need to specify to use the base class: use Request;.

Hope it helps!!
Thank You!

answered Aug 4 by Niroj
• 58,500 points

Related Questions In Laravel

+1 vote
1 answer

Error: laravel.log could not be opened?

Hello, Never use 777 for directories on your ...READ MORE

answered Apr 2 in Laravel by Niroj
• 58,500 points
2,536 views
0 votes
2 answers

Error:Class 'App\Http\Controllers\App\Model' not found?

Class ‘App\Http\Controllers\Auth’ Not Found in Class ‘App\Http\Controllers\Auth’ not ...READ MORE

answered Aug 6 in Laravel by pakainfo
2,899 views
0 votes
1 answer

Error:Laravel - Session store not set on request

Hello @kartik, You'll need to use the web middleware if ...READ MORE

answered Aug 4 in Laravel by Niroj
• 58,500 points
327 views
0 votes
1 answer

Error:Class 'App\Http\Controllers\Model' not found

Hello @kartik, You need to import your model ...READ MORE

answered Sep 11 in Laravel by Niroj
• 58,500 points
27 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 58,500 points
2,168 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 58,500 points
236 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 58,500 points
189 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 58,500 points
2,680 views
0 votes
1 answer

Error:Object of class Illuminate\Database\MySqlConnection could not be converted to string

Hello @kartik, The use keyword is what you need: $id = ...READ MORE

answered 2 days ago in Laravel by Niroj
• 58,500 points
18 views