Merge Invoice and Bill into Document

This commit is contained in:
Burak Çakırel
2020-12-24 01:28:38 +03:00
parent 830cc05957
commit 0c1424db47
436 changed files with 31655 additions and 37350 deletions

View File

@@ -1,46 +0,0 @@
<?php
namespace App\Imports\Purchases\Sheets;
use App\Abstracts\Import;
use App\Http\Requests\Purchase\BillHistory as Request;
use App\Models\Purchase\Bill;
use App\Models\Purchase\BillHistory as Model;
class BillHistories extends Import
{
public function model(array $row)
{
// @todo remove after laravel-excel 3.2 release
if ($row['bill_number'] == $this->empty_field) {
return null;
}
return new Model($row);
}
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['bill_id'] = (int) Bill::number($row['bill_number'])->pluck('id')->first();
$row['notify'] = (int) $row['notify'];
return $row;
}
public function rules(): array
{
$rules = (new Request())->rules();
$rules['bill_number'] = 'required|string';
unset($rules['bill_id']);
return $rules;
}
}