|null $ids */ public function __construct( private readonly ?array $ids = null, ) {} public function query(): Builder { $query = DisciplinaryReport::query()->with(['employee', 'creator']); if ($this->ids !== null) { $query->whereIn('id', $this->ids); } return $query->orderByDesc('report_date'); } /** * @return array */ public function headings(): array { return [ 'Employee Number', 'Employee Name', 'Report Date', 'Title', 'Description', 'Severity', 'Created By', ]; } /** * @param DisciplinaryReport $report * @return array */ public function map($report): array { return [ $report->employee?->employee_number, $report->employee?->full_name, $report->report_date?->toDateString(), $report->title, $report->description, $report->severity?->value, $report->creator?->name, ]; } }