Merge pull request #3022 from CihanSenturk/import-tax-type-issue
Fixed import tax unique type issue
This commit is contained in:
commit
a3008f8ea0
@ -12,6 +12,31 @@ class Taxes extends Import
|
|||||||
|
|
||||||
public function model(array $row)
|
public function model(array $row)
|
||||||
{
|
{
|
||||||
|
if (empty($row)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return new Model($row);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user