Fallback PayrollRunController to created_by Auth id for branch managers

This commit is contained in:
2026-07-06 13:16:00 +08:00
parent 611f1539b6
commit f851f30df5

View File

@@ -18,10 +18,8 @@ class PayrollRunController extends Controller
$query = PayrollRun::with(['creator'])->where(function ($q) {
if (Auth::user()->can('manage-any-payroll-runs')) {
$q->whereIn('created_by', getCompanyAndUsersId());
} elseif (Auth::user()->can('manage-own-payroll-runs')) {
$q->where('created_by', Auth::id());
} else {
$q->whereRaw('1 = 0');
$q->where('created_by', Auth::id());
}
});