Files
investbrain/app/Exports/Sheets/PortfoliosSheet.php
T

44 lines
875 B
PHP
Raw Normal View History

2024-08-07 18:29:23 -05:00
<?php
namespace App\Exports\Sheets;
use App\Models\Portfolio;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
class PortfoliosSheet implements FromCollection, WithHeadings, WithTitle
{
2024-08-29 23:36:44 -05:00
public function __construct(
public bool $empty = false
) { }
2024-08-07 18:29:23 -05:00
public function headings(): array
{
return [
2024-08-29 21:39:59 -05:00
'Portfolio ID',
2024-08-07 18:29:23 -05:00
'Title',
'Notes',
'Wishlist',
'Created',
2024-08-27 22:06:10 -05:00
'Updated'
2024-08-07 18:29:23 -05:00
];
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
2024-08-29 23:36:44 -05:00
return $this->empty ? collect() : Portfolio::myPortfolios()->get();
2024-08-07 18:29:23 -05:00
}
/**
* @return string
*/
public function title(): string
{
return 'Portfolios';
}
}