export abstract
This commit is contained in:
@ -2,41 +2,17 @@
|
||||
|
||||
namespace App\Exports\Banking;
|
||||
|
||||
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 Transactions implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
class Transactions extends Export
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::usingSearchString(request('search'))->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->type,
|
||||
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 [
|
||||
'type',
|
||||
@ -54,9 +30,4 @@ class Transactions implements FromCollection, ShouldAutoSize, WithHeadings, With
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'transactions';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user