Esempio n. 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     \App\RoomBook::create(array('room_no' => 'sic-201', 'user' => 'sanketark', 'duration' => 'NULL', 'purpose' => 'Seminar PPT', 'eventtype' => 'talk', 'priority' => '2', 'capacity' => '25', 'status' => 'C', 'starttime' => '2015-10-22 05:00:00', 'endtime' => '2015-10-22 06:00:00'));
     \App\RoomBook::create(array('room_no' => 'sic-201', 'user' => 'sanketark', 'duration' => 'NULL', 'purpose' => 'Walker ppt', 'eventtype' => 'talk', 'capacity' => '30', 'priority' => '2', 'status' => 'C', 'starttime' => '2015-10-25 05:20:00', 'endtime' => '2015-10-25 06:10:00'));
     \App\RoomBook::create(array('room_no' => 'sic-301', 'user' => 'abhay', 'duration' => 'NULL', 'purpose' => 'Lecture Series', 'eventtype' => 'talk', 'capacity' => '50', 'priority' => '2', 'status' => 'C', 'starttime' => '2015-11-11 05:20:00', 'endtime' => '2015-11-12 06:10:00'));
 }
Esempio n. 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $hname = Auth::user();
     $rno = Input::get('room_no');
     $st = Carbon::createFromFormat('d-m-Y H:i', Input::get('starttime'));
     $et = Carbon::createFromFormat('d-m-Y H:i', Input::get('endtime'));
     $currbooking = RoomBook::where('room_no', $rno)->where('starttime', '<', $et)->where('endtime', '>', $st)->get();
     $otherinputs = Input::except(array('_token', 'starttime', 'endtime'));
     $otherinputs['starttime'] = $st;
     $otherinputs['endtime'] = $et;
     $evttype = Input::get('eventtype');
     $evtconfig = Config::get('roomconfig.event_types');
     $otherinputs['priority'] = $evtconfig[$evttype]['priority'];
     if (!count($currbooking)) {
         $otherinputs['status'] = 'C';
         RoomBook::saveFormData($otherinputs);
         return redirect('home');
     } else {
         $otherinputs['status'] = 'W';
         RoomBook::saveFormData($otherinputs);
         return redirect('home');
     }
     //		return ("room booked");
 }