Пример #1
0
 public function get_student_for_call(Request $request)
 {
     $id = $request->id;
     if ($id) {
         $student = User::find($id);
     } else {
         $student = Register::getFirstUncallStudent();
     }
     $data = array();
     if (isset($student->id)) {
         $data['student'] = $student;
         $telecall = new TeleCall();
         $telecall->caller_id = $this->user->id;
         $telecall->student_id = $student->id;
         $telecall->note = null;
         $telecall->call_status = 2;
         $telecall->gen_id = Gen::getCurrentGen()->id;
         $telecall->save();
         $data['telecall_id'] = $telecall->id;
         return view('ajax.calling', $data);
     } else {
         return "Hết học viên chưa gọi";
     }
 }