$models = MyModel::whereNull('fabric')->get();
$fn2 = function (Pool $pool) use ($models) {
$arrayPools = array();
foreach ($models as $model) {
$arrayPools[] = $pool->as($model->id)
->withHeaders([
'Authorization' => 'Basic ' . $auth
])->post('url', [
'name' => $model->name,
'text' => $model->text
]);
}
return $arrayPools;
};
$response = Http::pool($fn2);
foreach ($models as $model) {
if (isset($response[$model->id])) {
$data = json_decode($response[$model->id]->body(), true);
if (isset($data['info']) && $data['info'] == "ok") {
//somecode
} else {
Log::info('RESPONSE: ' .var_export($response[$model->id]->body(), true), true);
}
} else {
Log::info('RESPONSE: BAD', true);
}
}
Внешний отчет возможно будет решением.
Спасибо!