load(['department', 'position', 'shift']); $summary = $this->statisticsService->summary($employee); return Pdf::loadView('exports.employee-profile', [ 'employee' => $employee, 'summary' => $summary, ])->download("employee-{$employee->employee_number}.pdf"); } /** * @param Collection $employees */ public function employeeList(Collection $employees): Response { $employees->load(['department', 'position', 'shift']); return Pdf::loadView('exports.employee-list', [ 'employees' => $employees, 'generatedAt' => now(), ])->download('employees-'.now()->format('Y-m-d').'.pdf'); } public function leaveSummary(Employee $employee): Response { $employee->load([ 'vacations' => fn ($query) => $query->latest('start_date')->limit(20), 'sickLeaves' => fn ($query) => $query->latest('start_date')->limit(20), 'unpaidLeaves' => fn ($query) => $query->latest('start_date')->limit(20), ]); $summary = $this->statisticsService->summary($employee); return Pdf::loadView('exports.leave-summary', [ 'employee' => $employee, 'summary' => $summary, ])->download("leave-summary-{$employee->employee_number}.pdf"); } }