From 1cb66c3c1df506f9bcd24e2ee499c4fc9f984505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Thu, 30 Sep 2021 18:02:55 +0300 Subject: [PATCH] Fixed duplicated issue when importing items --- app/Imports/Common/Sheets/ItemTaxes.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Imports/Common/Sheets/ItemTaxes.php b/app/Imports/Common/Sheets/ItemTaxes.php index 714f7c4a3..ec41d645c 100644 --- a/app/Imports/Common/Sheets/ItemTaxes.php +++ b/app/Imports/Common/Sheets/ItemTaxes.php @@ -4,6 +4,7 @@ namespace App\Imports\Common\Sheets; use App\Abstracts\Import; use App\Http\Requests\Common\ItemTax as Request; +use App\Models\Common\Item; use App\Models\Common\ItemTax as Model; class ItemTaxes extends Import @@ -17,7 +18,12 @@ class ItemTaxes extends Import { $row = parent::map($row); - $row['item_id'] = $this->getItemIdFromName($row); + $row['item_id'] = (int) Item::where('name', $row['item_name'])->value('id'); + + if ($this->isEmpty($row, 'item_id')) { + return []; + } + $row['tax_id'] = $this->getTaxId($row); return $row;