Я новичок в laravel и хочу передать данные массива из таблицы html в контроллер
Я пытался использовать этот код
Контроллер
foreach($request->input('chk', []) as $key => $chk){
$att = new Attendance;
$att->student_id = $key;
$att->date = $request->att_day;
$status = $chk == 'true' ? 1 : 0;
$att->status = $status;
}
View
<form action="{{route('attendance.save')}}" method="post" class="form-horizontal form-bordered">
<table class="table">
<thead>
<tr>
<th class="text-center">#</th>
<th>Student Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($students as $key => $s)
<tr>
<td class="text-center">{{ $key + 1 }}</td>
<td>{{ $s->student_name }}</td>
<td>
<div class="custom-control custom-radio radio-primary">
<input type="radio" id="rdo_{{$key}}_pre" name="rdo[{{$s->id}}]" class="custom-control-input" checked>
<label class="custom-control-label" for="rdo_{{$key}}_pre">Present</label>
</div>
<div class="custom-control custom-radio radio-pink">
<input type="radio" id="rdo_{{$key}}_abs" name="rdo[{{$s->id}}]" class="custom-control-input">
<label class="custom-control-label" for="rdo_{{$key}}_abs">Absent</label>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
Когда я проверяю данные, передаваемые в контроллер, все это 0 или 1 в соответствии с первыми данными в таблице. Как получить значение rdo, выбранное в представлении