export abstract

This commit is contained in:
denisdulici
2020-01-20 02:05:40 +03:00
parent 88dade86b6
commit 569f6c314f
19 changed files with 129 additions and 628 deletions

View File

@@ -2,23 +2,11 @@
namespace App\Exports\Purchases;
use App\Abstracts\Export;
use App\Models\Banking\Transaction as Model;
use Jenssegers\Date\Date;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithTitle;
class Payments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
class Payments extends Export
{
public $ids;
public function __construct($ids = null)
{
$this->ids = $ids;
}
public function collection()
{
$model = Model::type('expense')->usingSearchString(request('search'));
@@ -30,25 +18,7 @@ class Payments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
return $model->get();
}
public function map($model): array
{
return [
Date::parse($model->paid_at)->format('Y-m-d'),
$model->amount,
$model->currency_code,
$model->currency_rate,
$model->account_id,
$model->document_id,
$model->contact_id,
$model->category_id,
$model->description,
$model->payment_method,
$model->reference,
$model->reconciled,
];
}
public function headings(): array
public function fields(): array
{
return [
'paid_at',
@@ -65,9 +35,4 @@ class Payments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
'reconciled',
];
}
public function title(): string
{
return 'payments';
}
}