3

Hi have this function which is returning path of a file.

public function filecreate()
{
    $myHelper = new MyHelper();
    $path = $myHelper->create();

    return $path;
}

phpStorm showing warning of

Return value is expected to be 'illuminate\Http\Response', 'string' returned

1
  • Your problem is not in the code you have included in your question. Please check the stacktrace to figure out where the actual error is Commented Aug 2, 2018 at 9:39

3 Answers 3

5

You must use Response object in return, something like this with helper:

return response(%path_to_view);

Sign up to request clarification or add additional context in comments.

2 Comments

I am not returning it to view
Please show more of the code so we can put it into context
1
$myHelper = new MyHelper();
$path = $myHelper->create();

return response($path);

To return View use:

return response(view("page"));

To return String use:

return response("string");

To return Array use:

return response(['a', 'b', 'c']);

Comments

0

The response() helper may be used to generate other types of response instances. source

To return simple string use:

return response($path)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.