@if($question->question_type == 'radio')
@foreach(explode(',', $question->options) as $key => $option)
@php
$checked = '';
$option_id = explode(',', $question->option_ids)[$key];
@endphp
@if(in_array($question->id, array_column($response, 'question_id')))
@php
$index = array_search($question->id, array_column($response,
'question_id'));
@endphp
@if($response[$index]['response'] == $option_id)
@php $checked = 'checked'; @endphp
@endif
@endif
@endforeach
@endif
@if($question->question_type == 'checkbox')
@foreach(explode(',', $question->options) as $key => $option)
@php
$checked = '';
$option_id = explode(',', $question->option_ids)[$key];
@endphp
@if(in_array($question->id, array_column($response, 'question_id')))
@php
$index = array_search($question->id, array_column($response,
'question_id'));
@endphp
@if(in_array($option_id, explode(',',
$response[$index]['response'])))
@php $checked = 'checked'; @endphp
@endif
@endif
@endforeach
@endif
@if($question->question_type == 'select')
@endif