$promises = Http::pool(function (Pool $pool) use ($array, $schoolId) { foreach($array as $key => $v){ $filter = [ ]; $pool->withToken(Auth::user()->token()) ->get(Api::()->detail($schoolId,true), $filter); } }); $data = []; foreach($array as $key => $v){ $data[] = json_decode($promises[$key]->getBody(), true)['data'] ?? []; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter