akaunting/app/Exports/Purchases/Sheets/BillTransactions.php
2020-01-20 02:05:40 +03:00

39 lines
834 B
PHP

<?php
namespace App\Exports\Purchases\Sheets;
use App\Abstracts\Export;
use App\Models\Banking\Transaction as Model;
class BillTransactions extends Export
{
public function collection()
{
$model = Model::type('expense')->isDocument()->usingSearchString(request('search'));
if (!empty($this->ids)) {
$model->whereIn('document_id', (array) $this->ids);
}
return $model->get();
}
public function fields(): array
{
return [
'paid_at',
'amount',
'currency_code',
'currency_rate',
'account_id',
'document_id',
'contact_id',
'category_id',
'description',
'payment_method',
'reference',
'reconciled',
];
}
}