added scope for collection export
This commit is contained in:
@ -9,13 +9,7 @@ class InvoiceHistories extends Export
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::invoice()->with('document')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('document_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->cursor();
|
||||
return Model::with('document')->invoice()->collectForExport($this->ids, null, 'document_id');
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
@ -9,13 +9,7 @@ class InvoiceItemTaxes extends Export
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::invoice()->with('document', 'item', 'tax')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('document_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->cursor();
|
||||
return Model::with('document', 'item', 'tax')->invoice()->collectForExport($this->ids, null, 'document_id');
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
@ -9,13 +9,7 @@ class InvoiceItems extends Export
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::invoice()->with('document', 'item')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('document_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->cursor();
|
||||
return Model::with('document', 'item')->invoice()->collectForExport($this->ids, null, 'document_id');
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
@ -9,13 +9,7 @@ class InvoiceTotals extends Export
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::invoice()->with('document')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('document_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->cursor();
|
||||
return Model::with('document')->invoice()->collectForExport($this->ids, null, 'document_id');
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
@ -4,8 +4,6 @@ namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use App\Models\Document\Document;
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
@ -13,13 +11,7 @@ class InvoiceTransactions extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::with('account', 'category', 'contact', 'document')->income()->isDocument()->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('document_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->cursor();
|
||||
return Model::with('account', 'category', 'contact', 'document')->income()->isDocument()->collectForExport($this->ids, ['paid_at' => 'desc'], 'document_id');
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
@ -11,13 +11,7 @@ class Invoices extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::invoice()->with('category')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->cursor();
|
||||
return Model::with('category')->invoice()->collectForExport($this->ids, ['document_number' => 'desc']);
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
Reference in New Issue
Block a user