/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $classroom = new Classroom();
     $data = $request->all();
     $data["schedule_date_from"] = date("Y-m-d H:i:s", strtotime($data["schedule_date_from"]));
     $data["schedule_date_to"] = date("Y-m-d H:i:s", strtotime($data["schedule_date_to"]));
     $data["rel_instructor_id"] = Auth::user()->id;
     $classroom->fill($data);
     $classroom->save();
     return redirect('classrooms');
 }
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required']);
     $data = $request->all();
     $seatStyle = $data['seats_style'];
     array_forget($data, 'seats_style');
     $classrooms = new Classroom();
     $classrooms->fill($data);
     if ($seatStyle == 'rectangle') {
         $classrooms->seats_map = '["aaaa_","aaaa_","aaaaa","aaaa_","aaaaa","aaaa_","aaaa_","aaaa_","aaaa_","aaaaa","aaaa_","aaaa_","aaaaa"]';
         $classrooms->seats = '{"a": {"classes" : "rectangle"}}';
     } else {
         $classrooms->seats_map = '["aaaaaaa","aaaaaaa","aaaaaaa","aaaaaaa","_aaaaaa","__aaaaa"]';
         $classrooms->seats = '{"a": {"classes" : "triangle"}}';
     }
     $classrooms->save();
     return response()->json(['id' => $classrooms->id]);
 }