Exemplo n.º 1
0
 /**
  * Method that saves the Student Grades from the form.
  */
 protected function saveGrades(Request $request)
 {
     $id_student = $request->id_student;
     $ids_subject = $request->ids;
     $grades = $request->grades;
     $dates_taken = $request->dates_taken;
     $types = $request->types;
     $index = 0;
     //first position
     foreach ($ids_subject as $id_subject) {
         $grade = Grade::firstOrCreate(['id_subject' => $id_subject, 'id_student' => $id_student]);
         $grade->grade = $grades[$index];
         $grade->date_taken = $dates_taken[$index];
         $grade->type = $types[$index];
         $grade->save();
         $index++;
     }
     return redirect('student/' . $id_student);
 }
Exemplo n.º 2
0
                    <input type="hidden" name="id_student" value="{{$student->id}}">
                    <table class="table table-bordered table-hover table-striped">
                        <thead>
                        <tr>
                            <th>Id</th>
                            <th>Clave</th>
                            <th>Nombre</th>
                            <th>Calificaci&oacute;n</th>
                            <th>Fecha</th>
                            <th>Modalidad</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($module->subjects as $subject)
                        <?php 
$grade = \ceeacce\Grade::where(['id_subject' => $subject->id, "id_student" => $student->id])->first();
$studentGrade = isset($grade->grade) ? $grade->grade : 0;
?>
                        <tr>
                            <td><input type="hidden" value="{{$subject->id}}" name="ids[]">{{$subject->id}}</td>
                            <td>{{$subject->clv}}</td>
                            <td>{{mb_strtoupper($subject->name)}}</td>
                            <td><input type="text" name="grades[]" value="{{$studentGrade}}" disabled></td>
                            <td><input type="text" class="datepicker" name="dates_taken[]" value="{{(isset($grade->date_taken))?$grade->date_taken:''}}" disabled></td>
                            <td><input type="text" name="types[]" value="{{(isset($grade->type))?$grade->type:''}}" disabled></td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <input type="submit" value="Guardar" class="pull-right btn-success">
                    <input type="button" value="Editar" class="pull-right edit-grade-button btn-warning " data-id="{{$module->id}}">