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, 2020 in Laravel by kartik
• 37,510 points
9,902 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, 2020 by Niroj
• 82,880 points

Related Questions In Laravel

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 Sep 24, 2020 in Laravel by Niroj
• 82,880 points
3,183 views
+2 votes
1 answer

Error: laravel.log could not be opened?

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

answered Apr 2, 2020 in Laravel by Niroj
• 82,880 points
11,874 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, 2020 in Laravel by pakainfo
17,059 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, 2020 in Laravel by Niroj
• 82,880 points
21,879 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,681 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,542 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, 2020 in Laravel by Niroj
• 82,880 points
41,728 views
0 votes
1 answer

Error : Call to undefined method Illuminate\Http\Request::put()

Hello, You need to customize the request $data = ...READ MORE

answered Nov 11, 2020 in Laravel by Niroj
• 82,880 points
3,790 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP