Support the ongoing development of →
posted 8 years ago
Last updated 1 year ago.

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 8 years ago.

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


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


Sign in to participate in this thread!


Your banner here too?


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.

© 2024 - All rights reserved.