Skip to content

Commit

Permalink
Merge pull request #3022 from CihanSenturk/import-tax-type-issue
Browse files Browse the repository at this point in the history
Fixed import tax unique type issue
  • Loading branch information
cuneytsenturk committed Aug 14, 2023
2 parents 3c6a5b0 + e1fb015 commit a3008f8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/Imports/Settings/Taxes.php
Expand Up @@ -12,6 +12,31 @@ class Taxes extends Import

public function model(array $row)
{
if (empty($row)) {
return;
}

return new Model($row);
}

public function map($row): array
{
$row = parent::map($row);

if ($row['type'] == 'compound') {
$compound_tax = Model::where('type', 'compound')->first();

if ($compound_tax) {
$this->request_class = null;

// TODO: Add exception error
// throw new \Exception('Compound tax already exists.');

return [];
}
}

return $row;
}

}

0 comments on commit a3008f8

Please sign in to comment.