public function drop()
 {
     $section_id = Request::input('id');
     $section = Vsection::find($section_id);
     // dd($section);
     if ($section->course_type == "Pre-Requisite") {
         return json_encode(array("status" => "error", "message" => "Pre-Requisite cannot be dropped. Please contact the advisor"));
     }
     $user = Auth::user();
     Enrollment::drop($user->id, $section_id);
     file_put_contents("enroll_drop.log", date("F j, Y, g:i a") . " " . $user->student_id . "(" . $user->name . ") dropped from Section Id: " . $section_id . "\n", FILE_APPEND);
     return json_encode(array("status" => "success", "message" => "Drop Successfull"));
 }
Esempio n. 2
0
 public static function mass_drop($student_ids, $sid)
 {
     $messages = array();
     foreach ($student_ids as $student_id) {
         $user = User::findUserByStudentId($student_id);
         if ($user != null) {
             Enrollment::drop($user->id, $sid);
             $messages[] = $student_id . " dropped successfully";
         } else {
             $messages[] = $student_id . " does not exist";
         }
     }
     return $messages;
 }
Esempio n. 3
0
 public function dropAll()
 {
     $enrollments = Enrollment::where('student_id', '=', $this->id)->get();
     foreach ($enrollments as $enrollment) {
         Enrollment::drop($this->id, $enrollment->section_id);
     }
 }