@php $basic = $profile?->basic_salary ?? old('basic_salary'); $method = $profile?->payment_method ?? old('payment_method', 'bank_transfer'); $breaks = function (string $which) use ($profile) { $rows = $profile ? ($profile->{$which} ?? []) : []; for ($i = 0; $i < 3; $i++) { yield $rows[$i]['label'] ?? old($which.'_label.'.$i, ''); yield $rows[$i]['amount'] ?? old($which.'_amount.'.$i); } }; @endphp
@error('full_name')

{{ $message }}

@enderror
@error('basic_salary')

{{ $message }}

@enderror
@php $it = $breaks('allowances'); @endphp
@for ($i = 0; $i < 3; $i++)
{{ $it->next() }} {{ $it->next() }}
@endfor
@php $it = $breaks('deductions'); @endphp
@for ($i = 0; $i < 3; $i++)
{{ $it->next() }} {{ $it->next() }}
@endfor