Files
HRM-System/app/Console/Commands/SyncLegacyFixedOverrides.php
2026-04-20 00:20:10 +08:00

50 lines
1.9 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\User;
use App\Models\EmployeeSalary;
class SyncLegacyFixedOverrides extends Command
{
protected $signature = 'import:legacy-fixed-overrides';
protected $description = 'Inject hardcoded stat deductions specifically for Ana, Paul, Princess, Dinh.';
public function handle()
{
$this->info("Initializing Legacy Profile Matrix Hardcode Overrides...");
// Client explicit override configurations:
$configurations = [
'Ana' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
'Paul' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
'Princess' => ['sss' => 450, 'phic' => 250, 'hdmf' => 200],
'Dinh' => ['sss' => 450, 'phic' => 250, 'hdmf' => 200],
'Rhea' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
'Mart' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
'Reynah' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
'Francis' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
'Donna' => ['sss' => 585, 'phic' => 250, 'hdmf' => 200],
];
foreach ($configurations as $nameKey => $conf) {
$user = User::where('name', 'like', "%$nameKey%")->where('type', 'employee')->first();
if ($user && $user->employee) {
// Force sync directly onto their local salary block
EmployeeSalary::updateOrCreate(
['employee_id' => $user->id],
[
'sss_fixed' => $conf['sss'],
'philhealth_fixed' => $conf['phic'],
'pagibig_fixed' => $conf['hdmf'],
]
);
$this->line("Synched FIXED stats successfully onto profile mapping: $nameKey");
}
}
$this->info("Legacy Overrides synced successfully.");
}
}