36 lines
728 B
PHP
36 lines
728 B
PHP
<?php
|
|
|
|
namespace App\Imports\Common\Sheets;
|
|
|
|
use App\Abstracts\Import;
|
|
use App\Http\Requests\Common\ItemTax as Request;
|
|
use App\Models\Common\ItemTax as Model;
|
|
|
|
class ItemTaxes extends Import
|
|
{
|
|
public function model(array $row)
|
|
{
|
|
// @todo remove after laravel-excel 3.2 release
|
|
if ($row['item_name'] === $this->empty_field) {
|
|
return null;
|
|
}
|
|
|
|
return new Model($row);
|
|
}
|
|
|
|
public function map($row): array
|
|
{
|
|
$row = parent::map($row);
|
|
|
|
$row['item_id'] = $this->getItemIdFromName($row);
|
|
$row['tax_id'] = $this->getTaxId($row);
|
|
|
|
return $row;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return (new Request())->rules();
|
|
}
|
|
}
|