【发布时间】:2015-04-15 08:54:22
【问题描述】:
我想在我的状态所在的每一行为每个学生插入不同的状态(出席、缺席、迟到、其他)
这是我的看法
<div align="center"><b>List of Students Enrolled</b></div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Student ID</th>
<th>Student Name</th>
<th>Present</th>
<th>Late</th>
<th>Absent</th>
<th>Others</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
@foreach ($users as $users)
<tr>
<td>{{ $users->student_id }} </td>
<td>{{ $users->student_firstname }} {{ $users->student_lastname }}</td>
<td>{{ Form::radio('student['.$users->student_id.'][status]', 'present' , true) }}</td>
<td>{{ Form::radio('student['.$users->student_id.'][status]', 'late' ) }}</td>
<td>{{ Form::radio('student['.$users->student_id.'][status]', 'absent') }}</td>
<td>{{ Form::radio('student['.$users->student_id.'][status]', 'others') }}</td>
<td>{{ Form::text('student['.$users->student_id.'][comment]') }}</td>
@endforeach
无论如何我可以在我的控制器的一个函数中插入它吗?
谢谢!
【问题讨论】:
-
请清楚你要做什么
-
我想在我的表中插入每行每个学生的不同状态假设 student1 存在,student2 不存在......使用单选按钮作为每个学生的数组
-
为什么要名称为数组?您可以使用字符串连接创建不同的名称值:
'student'.$users->student_id -
uhm.... 不,实际上,我想要实现的是获得每个学生的结果(例如在场、缺席、迟到、其他),我指的是每一行都是学生 ID
标签: laravel laravel-4 eloquent laravel-5