Fallback PayrollRunController to created_by Auth id for branch managers
This commit is contained in:
@@ -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());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user