refactor: simplify payroll close command scheduling and update payroll closing notification content

This commit is contained in:
Yoga Pangestu 2025-12-18 09:48:50 +07:00
parent 40db1c006c
commit b66474ed3e
2 changed files with 15 additions and 3 deletions

View File

@ -6,6 +6,7 @@
use App\Jobs\StorePushNotification; use App\Jobs\StorePushNotification;
use App\Models\Payroll; use App\Models\Payroll;
use App\Models\PushNotification; use App\Models\PushNotification;
use App\Models\User;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Console\Command; use Illuminate\Console\Command;
@ -44,8 +45,19 @@ public function handle(): void
StorePushNotification::dispatch( StorePushNotification::dispatch(
PushNotification::whereIn('user_id', $userIds)->get(), PushNotification::whereIn('user_id', $userIds)->get(),
[ [
'title' => 'Gaji Sudah Cair 💸', 'title' => 'Hari Ditunggu Telah Tiba 🎉',
'body' => 'Kerja kerasmu terbayar. Gaji bulan '.formatDateLocalized($targetMonth, 'F Y').' sudah kami transfer. Semoga harimu menyenangkan.', 'body' => 'Hari ini kamu gajian untuk periode '.formatDateLocalized($targetMonth, 'F Y').'. Terima kasih sudah berkontribusi.',
'url' => route('studio.finance.payroll.index'),
],
);
$userIds = User::role('Developer')->pluck('id')->toArray();
StorePushNotification::dispatch(
PushNotification::whereIn('user_id', $userIds)->get(),
[
'title' => 'Hari Gajian Karyawan 💸',
'body' => 'Hari ini karyawan dijadwalkan menerima gaji periode '.formatDateLocalized($targetMonth, 'F Y').'. Pastikan saldo dan proses transfer telah siap.',
'url' => route('studio.finance.payroll.index'),
], ],
); );

View File

@ -3,5 +3,5 @@
use Illuminate\Support\Facades\Schedule; use Illuminate\Support\Facades\Schedule;
Schedule::command('payroll:generate --current')->monthly(); Schedule::command('payroll:generate --current')->monthly();
Schedule::command('payroll:close --current')->lastDayOfMonth('23:59'); Schedule::command('payroll:close --current')->lastDayOfMonth();
Schedule::command('stock-opname:generate')->monthlyOn(25, '00:00'); Schedule::command('stock-opname:generate')->monthlyOn(25, '00:00');