Support the ongoing development of Laravel.io →
Jobs
Last updated 1 month ago.
0

There are various ways to do this, but they depend on what exactly is handling the response. The simplest way is to build an array of return values inside the loop and then return all of them outside the loop.

$input = Input::except('_token');
$response = [];

foreach ($input as $key => $value) { $response[] = Response::json(['Filename: ' . $key]); }

return $response;
Last updated 7 years ago.
0

the parsing of the reponse didn't work, it returns an empty array :/

0

If you use array_push() in the loop it will append to the array--the existing code appears to reset the array every iteration.

0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.