close

[Solved] Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 Error Occurs?

Today I get the following error Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 in php.

How To Solve Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 Error ?

  1. How To Solve Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 Error ?

    To Solve Argument 1 passed toSymfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 Error You can not return this, the framework does not know what to do with this object, you should be executing the query and returning the result:

  2. Argument 1 passed to Symfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7

    To Solve Argument 1 passed toSymfony\Component\HttpFoundation\Response::setContent() with Axios Vue and Laravel 7 Error You can not return this, the framework does not know what to do with this object, you should be executing the query and returning the result:

Solution 1

You are returning an Eloquent Builder object from this route:

Route::get('contacts', function () {
    return Contact::latest()->orderBy('created_at', 'desc');
});

You can not return this, the framework does not know what to do with this object, you should be executing the query and returning the result:

return Contact::latest()->get();

Then this Collection will get serialized to JSON.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment