Fix LeaveBalanceController query relationship for branch_id

This commit is contained in:
2026-07-06 12:54:40 +08:00
parent 755650c3b3
commit 359de36252

View File

@@ -24,7 +24,7 @@ class LeaveBalanceController extends Controller
} elseif (Auth::user()->can('manage-leave-balances')) {
$branchId = Auth::user()->employee->branch_id ?? null;
if ($branchId) {
$q->whereHas('employee', function ($eq) use ($branchId) {
$q->whereHas('employee.employee', function ($eq) use ($branchId) {
$eq->where('branch_id', $branchId);
});
} else {