コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, $area, $professor)
 {
     $course = Course::where('id', $id)->first();
     $course = Course::findOrFail($id);
     $course->taken = 0;
     $course->save();
     $prof = Professor::findOrFail($professor);
     $selectedCourseSchedule = explode("-", $course->schedule);
     $professorLoad = $prof->current_load - count($selectedCourseSchedule) * 22.5;
     $prof->current_load = $professorLoad;
     $prof->save();
     $schedules = schedule::where('course_id', $id)->delete();
     return redirect("schedules/{$course->year}-{$course->semester}/{$area}/{$professor}");
 }