2020-02-25 14:56:48 +03:00

35 lines
691 B
PHP

<?php
namespace App\Imports\Purchases\Sheets;
use App\Abstracts\Import;
use App\Models\Purchase\Bill as Model;
use App\Http\Requests\Purchase\Bill as Request;
class Bills extends Import
{
public function model(array $row)
{
return new Model($row);
}
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['category_id'] = $this->getCategoryId($row, 'expense');
$row['contact_id'] = $this->getContactId($row, 'vendor');
return $row;
}
public function rules(): array
{
return (new Request())->rules();
}
}