including working export button
This commit is contained in:
hackerESQ
2024-08-27 22:06:10 -05:00
parent e21814714d
commit 12f3003a3a
16 changed files with 39 additions and 164 deletions
-6
View File
@@ -3,9 +3,6 @@
namespace App\Exports;
use App\Exports\Sheets\DailyChangesSheet;
use App\Exports\Sheets\SplitsSheet;
use App\Exports\Sheets\DividendsSheet;
use App\Exports\Sheets\MarketDataSheet;
use App\Exports\Sheets\PortfoliosSheet;
use App\Exports\Sheets\TransactionsSheet;
use Maatwebsite\Excel\Concerns\Exportable;
@@ -23,9 +20,6 @@ class BackupExport implements WithMultipleSheets
return [
new PortfoliosSheet,
new TransactionsSheet,
new MarketDataSheet,
new DividendsSheet,
new SplitsSheet,
new DailyChangesSheet
];
}
+3 -3
View File
@@ -13,13 +13,13 @@ class DailyChangesSheet implements FromCollection, WithHeadings, WithTitle
{
return [
'Date',
'User',
'Portfolio',
'Total Market Value',
'Total Cost Basis',
'Total Gain Loss',
'Total Dividends',
'Realized Gains',
'Notes'
'Annotation'
];
}
@@ -28,7 +28,7 @@ class DailyChangesSheet implements FromCollection, WithHeadings, WithTitle
*/
public function collection()
{
return DailyChange::myDailyChanges()->get();
return auth()->user()->daily_changes;
}
/**
-39
View File
@@ -1,39 +0,0 @@
<?php
namespace App\Exports\Sheets;
use App\Models\Dividend;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
class DividendsSheet implements FromCollection, WithHeadings, WithTitle
{
public function headings(): array
{
return [
'ID',
'Date',
'Symbol',
'Amount',
'Created',
'Updated',
];
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return Dividend::get();
}
/**
* @return string
*/
public function title(): string
{
return 'Dividends';
}
}
-42
View File
@@ -1,42 +0,0 @@
<?php
namespace App\Exports\Sheets;
use App\Models\MarketData;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
class MarketDataSheet implements FromCollection, WithHeadings, WithTitle
{
public function headings(): array
{
return [
'Symbol',
'Name',
'Market Value',
'52 Week Low',
'52 Week High',
'Dividend Date',
'Splits Synced To Holdings At',
'Created',
'Updated',
];
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return MarketData::get();
}
/**
* @return string
*/
public function title(): string
{
return 'Market Data';
}
}
+2 -2
View File
@@ -17,7 +17,7 @@ class PortfoliosSheet implements FromCollection, WithHeadings, WithTitle
'Notes',
'Wishlist',
'Created',
'Updated',
'Updated'
];
}
@@ -26,7 +26,7 @@ class PortfoliosSheet implements FromCollection, WithHeadings, WithTitle
*/
public function collection()
{
return Portfolio::myPortfolios()->get();
return auth()->user()->portfolios;
}
/**
-39
View File
@@ -1,39 +0,0 @@
<?php
namespace App\Exports\Sheets;
use App\Models\Split;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
class SplitsSheet implements FromCollection, WithHeadings, WithTitle
{
public function headings(): array
{
return [
'ID',
'Date',
'Symbol',
'Split',
'Created',
'Updated',
];
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return Split::get();
}
/**
* @return string
*/
public function title(): string
{
return 'Splits';
}
}
+12 -4
View File
@@ -12,10 +12,10 @@ class TransactionsSheet implements FromCollection, WithHeadings, WithTitle
public function headings(): array
{
return [
'ID',
'Transaction ID',
'Symbol',
'Portfolio',
'Transaction',
'Portfolio ID',
'Transaction Type',
'Quantity',
'Cost Basis',
'Sale Price',
@@ -23,6 +23,14 @@ class TransactionsSheet implements FromCollection, WithHeadings, WithTitle
'Date',
'Created',
'Updated',
'Company Name',
'Portfolio Title',
'Market Value',
'52 Week Low',
'52 Week High',
'Market Data Refresh Date',
'Gain/Loss Dollars',
'Owner ID'
];
}
@@ -31,7 +39,7 @@ class TransactionsSheet implements FromCollection, WithHeadings, WithTitle
*/
public function collection()
{
return Transaction::myTransactions()->get();
return auth()->user()->transactions;
}
/**