/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $data = json_decode(file_get_contents('database/scraped/coursesFall2016.json'));
     foreach ($data as $course) {
         // Requirements for course
         $faculty_id = Faculty::firstOrCreate(['name' => $course->faculty])->id;
         $name = substr($course->title, 0, -2);
         $number = $course->classNum;
         $credits = 3.0;
         // TODO delete this from the database
         $description = 'No description of the course.';
         // TODO maybe delete this from the database
         // end requirements for course
         // Requirements for scheduled_course
         $course_id = Course::firstOrCreate(['name' => $name, 'number' => $number, 'credits' => $credits, 'description' => $description, 'faculty_id' => $faculty_id])->id;
         $session_id = Session::firstOrCreate(['name' => $course->semester])->id;
         // end requirements for scheduled_course
         // Requirements for time_slot
         $scheduled_course_id = ScheduledCourse::firstOrCreate(['course_id' => $course_id, 'session_id' => $session_id])->id;
         if ($course->day != 'TBA') {
             $section = $course->section;
             $room = $course->room;
             $time_start = $course->timeBegin;
             $time_end = $course->timeEnd;
             $course_type_id = $this->getType($course->type)->id;
             //                $days = explode(';', preg_replace('/;$/', '', chunk_split($course->day, 2, ';')));
             $day = $course->day;
             //                    $day_of_week_id = $this->getDay($day)->id;
             TimeSlot::firstOrCreate(['scheduled_course_id' => $scheduled_course_id, 'section' => $section, 'room' => $room, 'time_start' => $time_start, 'time_end' => $time_end, 'day' => $day, 'course_type_id' => $course_type_id]);
         }
     }
     Model::reguard();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Session::firstOrCreate(['name' => 'Summer 2016']);
     Session::firstOrCreate(['name' => 'Fall 2016']);
     Session::firstOrCreate(['name' => 'Winter 2017']);
 }