@foreach ($witnesses as $index => $witness) @php preg_match('/(\d+)$/', $index, $matches); $loopIndex = $matches[1]; $witnessName = array_key_exists("witnessName{$loopIndex}", $form) ? $form["witnessName{$loopIndex}"] : ""; $witnessRelationship = array_key_exists("witnessRelationship{$loopIndex}", $form) ? $form["witnessRelationship{$loopIndex}"] : ""; @endphp
  1. @if (array_key_exists("witnessImage{$loopIndex}", $form) && is_string($form["witnessImage{$loopIndex}"]))
    @endif
    @if (array_key_exists("witnessImage{$loopIndex}", $form) && is_string($form["witnessImage{$loopIndex}"]))
    @endif
  2. @endforeach