wip
This commit is contained in:
@@ -12,15 +12,20 @@ class BackupExport implements WithMultipleSheets
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
public function __construct(
|
||||
public bool $empty = false
|
||||
)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
new PortfoliosSheet,
|
||||
new TransactionsSheet,
|
||||
new DailyChangesSheet
|
||||
new PortfoliosSheet($this->empty),
|
||||
new TransactionsSheet($this->empty),
|
||||
new DailyChangesSheet($this->empty)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@ use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class DailyChangesSheet implements FromCollection, WithHeadings, WithTitle
|
||||
{
|
||||
public function __construct(
|
||||
public bool $empty = false
|
||||
) { }
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
@@ -28,7 +32,7 @@ class DailyChangesSheet implements FromCollection, WithHeadings, WithTitle
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return DailyChange::myDailyChanges()->get();
|
||||
return $this->empty ? collect() : DailyChange::myDailyChanges()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,10 @@ use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class PortfoliosSheet implements FromCollection, WithHeadings, WithTitle
|
||||
{
|
||||
public function __construct(
|
||||
public bool $empty = false
|
||||
) { }
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
@@ -26,7 +30,7 @@ class PortfoliosSheet implements FromCollection, WithHeadings, WithTitle
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return Portfolio::myPortfolios()->get();
|
||||
return $this->empty ? collect() : Portfolio::myPortfolios()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,10 @@ use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
|
||||
class TransactionsSheet implements FromCollection, WithHeadings, WithTitle
|
||||
{
|
||||
public function __construct(
|
||||
public bool $empty = false
|
||||
) { }
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
@@ -32,7 +36,7 @@ class TransactionsSheet implements FromCollection, WithHeadings, WithTitle
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
return Transaction::myTransactions()->get();
|
||||
return $this->empty ? collect() : Transaction::myTransactions()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user