From 917e60c01390996c2137b95e43a705c5057890a5 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 30 Apr 2026 13:37:24 +0700 Subject: [PATCH] fix: exclude Owner and Developer roles from payroll generation command --- app/Console/Commands/GeneratePayrollCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/GeneratePayrollCommand.php b/app/Console/Commands/GeneratePayrollCommand.php index 41c5178..da05cd3 100644 --- a/app/Console/Commands/GeneratePayrollCommand.php +++ b/app/Console/Commands/GeneratePayrollCommand.php @@ -33,7 +33,11 @@ public function handle() { $periodMonth = $this->argument('period') ?? Carbon::now()->format('Y-m'); $periodMonthFormatted = Carbon::parse($periodMonth)->translatedFormat('F Y'); - $users = User::with('profile')->get(); + $users = User::with('profile') + ->whereDoesntHave('roles', function ($query) { + $query->whereIn('name', ['Owner', 'Developer']); + }) + ->get(); $count = 0; try {