Are you saying you just want a data entry form to submit, and the data entered goes to the database? Have you looked at the intermediate tutorial that's right in the docs, which can also be downloaded from Github. It would be similar to a new user form. Sorry if I mis-understand what you are after.
Apr 22, 2016
5
Level 1
Best way to do foreach input form
I know what i've done so far isn't correct, but trying to work out how to do it correctly, was hoping you guys could share insight on how to do it on laravel.
Basically on my view, it is retrieving all hte students in that lesson, and allowing you to take attendance for all the users. But i don't want to create a form for each student. But to create an array i guess?? So i can create new record in the database upon submission.
{!! Form::open([
'url' => '/teacher/lessons/'. $lesson->id .'/attendance/new',
'method' => 'POST'
]) !!}
{!! Form::hidden('lesson_id', $lesson->id) !!}
@foreach ($lesson->students as $ls)
{!! Form::label('attendance', $ls->name) !!}
{!! Form::select('attendance', [
'true' => 'Attended',
'false' => 'Absent'],
null,
['class' => 'form-control'])
!!}
{!! Form::hidden('student_id', $ls->id) !!}
@endforeach
{!! Form::submit('Submit Class Attendance', [
'class' => 'btn btn-success'
]) !!}
{!! Form::close() !!}
How would i structure the form to be able to do that??
Please or to participate in this conversation.