From cdea7ec0702e47476bb4637301bf43595278be8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Wed, 8 Feb 2023 01:36:42 +0300 Subject: [PATCH] fixed import item issue --- app/Imports/Common/Sheets/ItemTaxes.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Imports/Common/Sheets/ItemTaxes.php b/app/Imports/Common/Sheets/ItemTaxes.php index ec41d645c..3ea4f2efb 100644 --- a/app/Imports/Common/Sheets/ItemTaxes.php +++ b/app/Imports/Common/Sheets/ItemTaxes.php @@ -4,7 +4,6 @@ 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 @@ -16,14 +15,14 @@ class ItemTaxes extends Import public function map($row): array { - $row = parent::map($row); - - $row['item_id'] = (int) Item::where('name', $row['item_name'])->value('id'); - - if ($this->isEmpty($row, 'item_id')) { + if ($this->isEmpty($row, 'item_name')) { return []; } + $row = parent::map($row); + + $row['item_id'] = $this->getItemId($row); + $row['tax_id'] = $this->getTaxId($row); return $row;