@Cronix Thanks for answering. I don't know understand what I have to do?
If I try to upload in bulk (let's say 100) how can I do that? Because I am not sure that the record exists or not in DB yet. I am using updateOrCreate().
My main "table" is products. So first I check in that table whether a product id exists or not. If it doesn't exist it creates a new id.
$result = Products::createORUpdate("App\Model\Products", ["seller_id" =>$value["seller_id"]], $products);
$product_id = $result->getKey();
//genralmodal::createORUpdate()
public static function createORUpdate($model, array $whereColumn, array
$updateORNewInsertColumns)
{
return $model::updateOrCreate($whereColumn, $updateORNewInsertColumns);
}
Once I get Product id then I run the following lines:
ProductsAttributes::createORUpdate("App\Model\ProductsAttributes", ["product_id" => $product_id], $pAttr);
....
ProductsDescription::createORUpdate("App\Model\ProductsDescription", ["product_id" => $product_id], $pDesc);
I have run/test on localhost windows 7 and xampp php7.1.*. It is still running for last 35mins.
Please, Guys, Help me.
How can I do in bulk if it can speed up? How should be array structure that laravel accept to update or insert in bulk?