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 Bills 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 Bills 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 Bills extends Export
'amount',
'currency_code',
'currency_rate',
'category_id',
'contact_id',
'category_name',
'contact_name',
'contact_email',
'contact_tax_number',