@php use App\Services\GfLoanService; use App\Services\PfLoanService; use App\Services\SwfLoanService; use App\Support\LoanCalculationMethod; $periods = match ($fund ?? 'pf') { 'swf' => SwfLoanService::LOAN_PERIODS, 'gf' => GfLoanService::LOAN_PERIODS, default => PfLoanService::LOAN_PERIODS, }; $minGuarantors = (int) ($minGuarantors ?? 0); $selectedGuarantors = old('guarantors', $loan->guarantors->pluck('user_id')->all()); $loanDecimalInput = static function ($loan, string $attribute, $default = '') { $fromOld = old($attribute); if ($fromOld !== null) { return $fromOld; } $raw = $loan->getAttributes()[$attribute] ?? null; return ($raw !== null && $raw !== '') ? $raw : $default; }; @endphp