Ansib Raza
Ansib Raza

Reputation: 408

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttp\Psr7\Request

When posting form I am getting this exception

Unresolvable dependency resolving [Parameter #0 [ $method ]] in class GuzzleHttp\Psr7\Request

Searched and tried many ways to solve this but no progress. Seems that my problem is same as this issue

Any positive response will be appreciated. Thank You.

Upvotes: 15

Views: 34731

Answers (4)

Luca Pisoni
Luca Pisoni

Reputation: 465

Maybe is already solved, but someone can need an additional help:

In my case problem was in controller.

Make sure that the Request is setted up in correct way starting from Controller.

From:

use Illuminate\Http\Client\Request;

To:

use Illuminate\Http\Request;

Upvotes: 4

Nirav Sheth
Nirav Sheth

Reputation: 686

I had the same error and found solution by removing following line.

use GuzzleHttp\Psr7\Request;

and use following Request class instead.

use Illuminate\Http\Request;

I hope it will help you too.

Upvotes: 67

Saiful Islam
Saiful Islam

Reputation: 141

I have also faced same error like in Laravel

Unresolvable dependency resolving [Parameter #0 [ $method ]] in class GuzzleHttp\Psr7\Request.

But when I changed

use GuzzleHttp\Psr7\Request; 

to

use Illuminate\Http\Request;

then the problem was gone.

Upvotes: 9

harbrinder_singh
harbrinder_singh

Reputation: 462

I have supplied parameters to _contruct function which do not have default value.

protected $method;

public function __construct($method){
}

I changed it to

protected $method;

public function __construct($method=''){
}

Upvotes: 9

Related Questions