Support the ongoing development of Laravel.io →
posted 9 years ago
Jobs
Last updated 2 years 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 9 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!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.