dongoldstein
Saving the received data line by line
Fixed;
CreateRecord File:
protected function handleRecordCreation(array $data): Model
{
$stocks = explode(PHP_EOL, $data['stock_detail']);
unset($data["stock_detail"]);
$stockData = [];
foreach ($stocks as $stock){
$data["stock_detail"] = $stock;
$tempData = static::getModel()::create($data);
$stockData[] = $tempData;
}
return $stockData[0];
}
4 replies