This commit is contained in:
Shubham Mehrotra 2020-04-15 13:08:11 +05:30
parent ef7d718d1f
commit e4c96ad3a5
1 changed files with 15 additions and 6 deletions

View File

@ -110,12 +110,21 @@ class Helper extends Review
foreach ($orderItems as $key => $orderItem) {
$products[] = $orderItem->product;
$this->orderBrandsRepository->create([
'order_item_id' => $orderItem->id,
'order_id' => $orderItem->order_id,
'product_id' => $orderItem->product_id,
'brand' => $products[$key]->brand,
]);
try {
$this->orderBrandsRepository->create([
'order_item_id' => $orderItem->id,
'order_id' => $orderItem->order_id,
'product_id' => $orderItem->product_id,
'brand' => $products[$key]->brand,
]);
} catch(\Exception $exception) {
$this->orderBrandsRepository->create([
'brand' => null,
'order_item_id' => $orderItem->id,
'order_id' => $orderItem->order_id,
'product_id' => $orderItem->product_id,
]);
}
}
}