bills import/export

This commit is contained in:
denisdulici
2020-01-21 09:55:12 +03:00
parent 45c02d5502
commit 1383dd4758
18 changed files with 242 additions and 51 deletions

View File

@@ -9,7 +9,7 @@ class BillItems extends Export
{
public function collection()
{
$model = Model::usingSearchString(request('search'));
$model = Model::with(['bill', 'item'])->usingSearchString(request('search'));
if (!empty($this->ids)) {
$model->whereIn('bill_id', (array) $this->ids);
@@ -18,12 +18,19 @@ class BillItems extends Export
return $model->get();
}
public function map($model): array
{
$model->bill_number = $model->bill->bill_number;
$model->item_name = $model->item->name;
return parent::map($model);
}
public function fields(): array
{
return [
'bill_id',
'item_id',
'name',
'bill_number',
'item_name',
'quantity',
'price',
'total',