35 lines
692 B
PHP
35 lines
692 B
PHP
<?php
|
|
|
|
namespace App\Imports\Sales\Sheets;
|
|
|
|
use App\Abstracts\Import;
|
|
use App\Http\Requests\Sale\Invoice as Request;
|
|
use App\Models\Sale\Invoice as Model;
|
|
|
|
class Invoices extends Import
|
|
{
|
|
public function model(array $row)
|
|
{
|
|
return new Model($row);
|
|
}
|
|
|
|
public function map($row): array
|
|
{
|
|
if ($this->isEmpty($row, 'invoice_number')) {
|
|
return [];
|
|
}
|
|
|
|
$row = parent::map($row);
|
|
|
|
$row['category_id'] = $this->getCategoryId($row, 'income');
|
|
$row['contact_id'] = $this->getContactId($row, 'customer');
|
|
|
|
return $row;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return (new Request())->rules();
|
|
}
|
|
}
|