Files
portal-api/app/Exports/Reports/ReportRowsExport.php
T
baodev0 c377c7e195 feat: add domain registration form and email notifications
- Create a new Blade view for domain registration (`registrant-tochuc.blade.php`) to capture organization and manager details.
- Implement email templates for new domain orders for both admin (`domain-order-new.blade.php`) and customers (`domain-order-received.blade.php`).
- Add CSV exports for client and domain data.
- Introduce tests for customer mass assignment, password reset, login throttling, and permission gating.
- Ensure service renewals use current pricing and validate ownership for virtual machines.
- Validate mass assignment behavior in service model.
2026-08-22 17:30:55 +07:00

39 lines
1.1 KiB
PHP

<?php
namespace App\Exports\Reports;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
/**
* Generic row/field-selection export used by all report export types
* (clients, domains, invoices, services, transactions). Rows are already
* resolved to associative arrays by ExportController::rowValues() — this
* class only handles field selection + CSV/XLSX writing.
*/
class ReportRowsExport implements FromCollection, WithHeadings, WithMapping
{
public function __construct(
private readonly Collection $rows,
private readonly array $fields,
private readonly array $labels
) {}
public function collection(): Collection
{
return $this->rows;
}
public function headings(): array
{
return array_map(fn ($field) => $this->labels[$field] ?? $field, $this->fields);
}
public function map($row): array
{
return array_map(fn ($field) => $row[$field] ?? '', $this->fields);
}
}