2024-08-07 18:29:23 -05:00
|
|
|
<?php
|
|
|
|
|
|
2025-01-28 17:33:54 -06:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2024-08-07 18:29:23 -05:00
|
|
|
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
|
2025-01-28 17:14:49 -06:00
|
|
|
) {}
|
|
|
|
|
|
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',
|
2025-01-28 17:14:49 -06:00
|
|
|
'Updated',
|
2024-08-07 18:29:23 -05:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2025-01-28 17:14:49 -06:00
|
|
|
* @return \Illuminate\Support\Collection
|
|
|
|
|
*/
|
2024-08-07 18:29:23 -05:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function title(): string
|
|
|
|
|
{
|
|
|
|
|
return 'Portfolios';
|
|
|
|
|
}
|
|
|
|
|
}
|