Merge pull request #2272 from CihanSenturk/master

Fixed duplicated issue when importing items
This commit is contained in:
Cüneyt Şentürk 2021-10-01 17:53:15 +03:00 committed by GitHub
commit cc21a62ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;