|null $ids */ public function __construct( private readonly ?array $ids = null, ) {} public function query(): Builder { $query = Employee::query() ->with(['department', 'position', 'shift']); if ($this->ids !== null) { $query->whereIn('id', $this->ids); } return $query->orderBy('employee_number'); } /** * @return array */ public function headings(): array { return [ 'Employee Number', 'Full Name', 'National ID', 'Gender', 'Birth Date', 'Phone', 'Address', 'Department', 'Position', 'Shift', 'Employment Status', 'Hire Date', 'Termination Date', 'Notes', ]; } /** * @param Employee $employee * @return array */ public function map($employee): array { return [ $employee->employee_number, $employee->full_name, $employee->national_id, $employee->gender?->value, $employee->birth_date?->toDateString(), $employee->phone, $employee->address, $employee->department?->name, $employee->position?->name, $employee->shift?->name, $employee->employment_status?->value, $employee->hire_date?->toDateString(), $employee->termination_date?->toDateString(), $employee->notes, ]; } }