Beispiel #1
0
 public function checkInOut(Request $request)
 {
     $result_data = ['student_id' => $this->student->id, 'exam_id' => $request->input('exam_id'), 'semester_id' => $this->semester->id];
     $result = ExamResult::firstOrCreate($result_data);
     if ($request->input('type', 'in') == 'in') {
         $result->enter_at = new DateTime();
     } else {
         $result->exit_at = new DateTime();
     }
     $result->save();
     return response()->json(['error' => false], 200, [], JSON_NUMERIC_CHECK);
 }