human friendly invoice import/export

This commit is contained in:
denisdulici
2020-01-20 22:58:49 +03:00
parent 8562223ff3
commit 6923a3d6e4
27 changed files with 497 additions and 76 deletions

View File

@@ -9,7 +9,7 @@ class Invoices extends Export
{
public function collection()
{
$model = Model::usingSearchString(request('search'));
$model = Model::with(['category'])->usingSearchString(request('search'));
if (!empty($this->ids)) {
$model->whereIn('id', (array) $this->ids);
@@ -18,6 +18,13 @@ class Invoices extends Export
return $model->get();
}
public function map($model): array
{
$model->category_name = $model->category->name;
return parent::map($model);
}
public function fields(): array
{
return [
@@ -29,8 +36,7 @@ class Invoices extends Export
'amount',
'currency_code',
'currency_rate',
'category_id',
'contact_id',
'category_name',
'contact_name',
'contact_email',
'contact_tax_number',