store/app/Console/Commands/OpenPayrollPeriodCommand.php

27 lines
668 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\Finance\PayrollService;
use Illuminate\Console\Command;
class OpenPayrollPeriodCommand extends Command
{
protected $signature = 'payroll:open-period';
protected $description = 'Tutup periode gaji terbuka, buka periode bulan ini, dan generate gaji pegawai';
public function handle(PayrollService $payrollService): int
{
$period = $payrollService->openCurrentPeriod();
$this->info(sprintf(
'Periode gaji %s dibuka. Total %d slip gaji.',
$period->period_label,
$period->payrolls()->count(),
));
return self::SUCCESS;
}
}