human friendly invoice import/export
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user