public function done(Request $request) { $this->validate($request, ['startDate' => 'required', 'endDate' => 'required', 'room' => 'required'], ['startDate.required' => 'Incheckinings-datum måste anges!', 'endDate.required' => 'Utcheckinings-datum måste anges!', 'room.required' => 'Rum måste väljas']); Order::updateOrCreate(['id' => $request->submit], array('arrives' => $request->startDate, 'departures' => $request->endDate, 'roomid' => $request->room)); $room = Room::where(['id' => $request->room])->first(); return view('booking.done', ['room' => $room, 'startDate' => $request->startDate, 'endDate' => $request->endDate]); }
/** * add a checkout * @param Request $request [description] * @return [type] [description] */ public function addCheckout(Request $request) { $checkout = new Checkout(); $checkout = $request->all(); Checkout::create($checkout); //update status room Room::where('name', $checkout['room_name'])->update(array('status' => 'A')); return redirect()->route('listroom_com'); }
/** * Test join with pin */ public function testJoinPin() { $this->visit('/room/create')->type('unit_testing', 'name')->check('public')->press('my_submit'); //edit room $room = Room::where('name', 'unit_testing')->firstOrFail(); $this->visit('/room/withPin')->type($room->access_pin, 'access_pin'); //TODO crashes from external redirect //->press('join_withPin_submit'); }
/** * Run the database seeds. * * @return void */ public function run() { $room_id = \App\Room::where('room_name', '=', '2nd Floor Conference Room')->pluck('id'); DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '09:00:00', 'available_until' => '18:00:00', 'available_weekdays' => '0101110']); $room_id = \App\Room::where('room_name', '=', '2nd Floor Conference Room')->pluck('id'); DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '20:00:00', 'available_until' => '21:00:00', 'available_weekdays' => '0100010']); $room_id = \App\Room::where('room_name', '=', 'Room 103')->pluck('id'); DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '09:00:00', 'available_until' => '12:00:00', 'available_weekdays' => '0111110']); $room_id = \App\Room::where('room_name', '=', 'Room 101')->pluck('id'); DB::table('timeslots')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'available_from' => '10:00:00', 'available_until' => '16:00:00', 'available_weekdays' => '1000011']); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create(); $room_id = \App\Room::where('room_name', '=', '2nd Floor Conference Room')->pluck('id'); $user_id = \App\User::where('email', '=', '*****@*****.**')->pluck('id'); $admin_id = \App\User::where('email', '=', '*****@*****.**')->pluck('id'); DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 1 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-24-2015'), 'start_time' => '09:00:00', 'end_time' => '09:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]); DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 1 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-24-2013'), 'start_time' => '09:00:00', 'end_time' => '14:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]); DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 1 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-25-2015'), 'start_time' => '09:00:00', 'end_time' => '09:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]); $room_id = \App\Room::where('room_name', '=', '2nd Floor Piano Room')->pluck('id'); DB::table('reservations')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'room_id' => $room_id, 'user_id' => $user_id, 'user_group' => 'Joshua 2 Fellowship', 'description_of_event' => $faker->text($maxNbChars = 200), 'date_of_event' => DateTime::createFromFormat('m-j-Y', '12-25-2015'), 'start_time' => '09:00:00', 'end_time' => '09:30:00', 'expected_num_of_attendees' => 10, 'status' => 'approved', 'status_notes' => 'approved on 12/14/15.', 'approved_by' => $admin_id]); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); $reservations = Reservation::all(); $room = DB::table('room')->min('id'); foreach ($reservations as $reservation) { $reservedRoom = new ReservedRoom(); $reservedRoom->reservation_id = $reservation->id; $reservedRoom->room_id = $room; $reservedRoom->save(); $room = Room::where('id', '>', $room)->min('id'); } }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { $router->bind('facility', function ($slug) { return \App\Facility::where('slug', $slug)->first(); }); $router->bind('type', function ($slug) { return \App\RoomType::where('slug', $slug)->first(); }); $router->bind('room', function ($room_no) { return \App\Room::where('room_no', $room_no)->first(); }); $router->model('reservation', 'App\\Reservation'); parent::boot($router); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($slug) { $room = Room::where('slug', $slug)->get(); $playlists = DB::table('playlist')->where('room_id', $room->first()->id)->get(); // var_dump($playlists); if ($room->isEmpty()) { abort(404); } $user_id = Auth::user()->id; $is_owner = false; if ($user_id === (int) $room->first()->user_id) { $is_owner = true; } return view('room.show')->with(array('room' => $room, 'playlist' => $playlists, 'is_owner' => $is_owner)); }
public function update_playlist(Request $request) { $user = Auth::user(); $room = Room::where('slug', $request['slug'])->get(); $room_playlists = DB::table('playlist')->where('room_id', $room->first()->id)->get(); $playlist = array(); $is_owner = $room->first()->user_id === $user->id; if (!empty($room_playlists)) { foreach ($room_playlists as $item) { $playlist['items'][] = array('videoId' => $item->video_id, 'videoName' => $item->name, 'id' => $item->id); $playlist['user']['owner'] = $is_owner; } } return json_encode($playlist); }
public function bookingRoomPost(Request $request) { $data['title'] = "Make reservation"; //save to guest table $guest = new Guest(); $guest = $request->all(); $guest_id = Guest::create($guest); //save to booking table $booking = new Booking(); $booking = $request->all(); $booking['guest_id'] = $guest_id->id; Booking::create($booking); //update status room Room::where('name', $booking['room_name'])->update(array('status' => 'N')); return redirect()->route('listbooking_com'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($buildingId) { // $rooms = Room::with("building") $rooms = Room::where('building_id', $buildingId)->get(); $today = new \DateTime('today'); foreach ($rooms as &$room) { $contract = Contract::where('room_id', $room['id'])->where('end_time', '>=', $today)->get(); if ($contract->count() > 0) { $room['hasContract'] = 1; $room['contract'] = $contract[0]; } else { $room['hasContract'] = 0; } } return $rooms; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $token = $request->header('token'); $room = Room::where('token', '=', $token)->first(); if (!$token) { // If there is not a token return Response::json(['status_code' => 404, 'errors' => "You must have token on the header"], 404); } else { if (!$room) { // If token is not link to a room return Response::json(['status_code' => 404, 'errors' => "Token wrong"], 404); } } $request->token = $token; $request->room = $room; return $next($request); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $buildings = Building::all(); $today = new \DateTime('today'); foreach ($buildings as &$building) { $roomsCount = Room::where("building_id", $building['id'])->count(); $contractsCount = Contract::where('building_id', $building['id'])->where('end_time', '>=', $today)->count(); $building['contractsNumber'] = $contractsCount; $building['emptyNumber'] = $roomsCount - $contractsCount; $building['rooms_count'] = $roomsCount; if ($building['emptyNumber'] > 0) { $building['hasEmptyRoom'] = 1; } else { $building['hasEmptyRoom'] = 0; } } return $buildings; }
/** * Check available rooms * * @return array */ public function checkAvailability(Request $request) { //add params start_date, end_date //Start date_input $input = $request->all(); $currentOccupants = []; $rooms = Room::all(); $check_date = Reservation::whereBetween('start_date', [$input['start_date'], $input['end_date']])->get(); foreach ($rooms as $index => $room) { # code... $currentOccupants[$index] = Reservation::where('room_id', $room->id)->where('status', 'accepted')->where('start_date', '<=', [$input['start_date']])->where('end_date', '>=', [$input['end_date']])->count(); } // //EOF date_input //display all_table $all_table = Room::where('availability', 'vacant')->get(); // return view('welcome')->with('table',$table); return view('welcome')->with(compact('check_date', 'input', 'all_table', 'currentOccupants')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $input = $request->all(); $currentOccupants = []; $rooms = Room::all(); $reservations_count = Reservation::where('room_id', $input['room_id'])->where('status', 'accepted')->where('start_date', '<=', [$input['start_date']])->where('end_date', '>=', [$input['end_date']])->count(); $room = Room::find($input['room_id']); foreach ($rooms as $index => $roomz) { $currentOccupants[$index] = Reservation::where('room_id', $roomz->id)->where('status', 'accepted')->where('start_date', '<=', [$input['start_date']])->where('end_date', '>=', [$input['end_date']])->count(); } $all_table = Room::where('availability', 'vacant')->get(); if ($reservations_count == $room->pax) { return view('reservations.error')->with(compact('input', 'all_table', 'currentOccupants')); } $person = new Person(); $person->unique_id = $this->quickRandom(); $person->first_name = $request->input('first_name'); $person->last_name = $request->input('last_name'); $person->address = $request->input('address'); $person->email = $request->input('email'); $person->phone = $request->input('phone'); if ($person->save()) { $reservation = new Reservation(); $reservation->person_id = $person->id; $reservation->status = Reservation::STATUS_PENDING; $reservation->price = Room::find((int) $request->input('room_id'))->price; $reservation->notes = $request->input('notes'); $reservation->start_date = $request->input('start_date'); $reservation->end_date = $request->input('end_date'); $reservation->room_id = (int) $request->input('room_id'); if ($reservation->save()) { return view('reservations.confirmation'); //TODO redirect to a page with success message } else { return 'Fail reservation'; //TODO redirect to a page with error message } } else { return 'Fail Person'; //TODO redirect to a page with error message } }
public function searchTypeRoom(request $request) { $id = $request->get('id'); $type = TypeRoom::find($id)->id; $rooms = Room::where('type_room_id', '=', $type)->get(); $start = $request->get('start'); $exit = $request->get('exit'); $start = str_replace('-', '', $start); $exit = str_replace('-', '', $exit); // $reserveRoom = ReserveRoom:: // $reserveRoomExit = str_replace('-','',$reserveRoom->exit_at); // $reserveRoomStart = str_replace('-','',$reserveRoom->start_at); $reserveRooms = ReserveRoom::where('type_room_id', $type)->get(); // foreach ($reserveRooms as $reserveRoom) { // echo $reserveRoom->id; // } // if ($start >= $reserveRoomStart && $start <= $reserveRoomExit) { // echo "denegado"; // }else{ // echo "Aceptado"; // } }
/** * Allocate a Classroom * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(ClassroomRequest $request) { $from = strtotime($request->input('from')); $to = strtotime($request->input('to')); $duration = round(abs($to - $from) / 60, 2); //time difference=(to-from)minute $from = date('G:i:s', $from); //convert to 24 hr format $to = date('G:i:s', $to); //convert to 24 hr format $classroom = new Classroom($request->except(['from', 'to'])); $classroom->from = $from; $classroom->to = $to; $classroom->duration = $duration; $department = Department::where('name', $request->input('department'))->first(); $room = Room::where('name', $request->input('room'))->first(); $course = Course::where('name', $request->input('course_name'))->first(); $classroom->room()->associate($room); $classroom->department()->associate($department); $classroom->course()->associate($course); $classroom->save(); $request->session()->flash('status', 'Classroom was saved successful!'); return back(); }
public function deleteRoom($id) { Room::where('id', $id)->delete(); return redirect()->route('listroom_com'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $roomId = Request::get('id'); Room::where('id', $roomId)->delete(); return redirect("rooms"); }
public function gestion() { $matter_count = Matter::where('user_id', \Auth::user()->id)->count(); $branch_count = \Auth::user()->branches()->where('school_year_id', \App\SchoolYear::getSchoolYearId())->count(); $level_count = \Auth::user()->leslevels()->where('school_year_id', \App\SchoolYear::getSchoolYearId())->count(); $cr_count = Classroom::where('user_id', \Auth::user()->id)->CurrentYear()->count(); $room_count = Room::where('user_id', \Auth::user()->id)->count(); return view('statistics.gestion', compact('matter_count', 'branch_count', 'level_count', 'cr_count', 'room_count')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { //make validations $validator = Validator::make($request->all(), ['name' => 'required', 'email' => 'array']); $validator->each('email', ['email']); if ($validator->fails()) { return redirect('room/create')->withErrors($validator)->withInput()->with('validation_err', true); } $room = new Room(); $room->name = $request->input('name'); $room->recording = empty($request->input('recording')) ? 0 : 1; $room->public = empty($request->input('public')) ? 0 : 1; $room->att_pass = Str::quickRandom(8); $room->mod_pass = Str::quickRandom(8); //add owner $user = Auth::User(); $room->owner = $user->id; //check if meeting id exists \DB::transaction(function () use($room) { //check for unique access_pin and meeting id do { $bbb_meeting_id = Str::quickRandom(8); } while (Room::where('bbb_meeting_id', '=', $bbb_meeting_id)->count() != 0); do { $access_pin = mt_rand(0, 999999); } while (Room::where('access_pin', '=', $access_pin)->count() != 0); $room->bbb_meeting_id = $bbb_meeting_id; $room->access_pin = $access_pin; $room->save(); }); //extract emails /*$mails = preg_split('/\r\n|\n|\r/', $request->input('participants')); $part_mails = array(); foreach($mails as $mail){ $part_mail = filter_var($mail, FILTER_VALIDATE_EMAIL); if($part_mail){ $participant = new Participant(); $participant->mail = $part_mail; $participant->room_id = $room->id; $participant->save(); } }*/ $emails = $request->input('email'); $moderators = $request->input('moderator'); if (!$moderators) { $moderators = array(); } if (is_array($emails)) { foreach ($emails as $email) { $participant = new Participant(); $participant->mail = $email; $participant->room_id = $room->id; if (in_array($email, $moderators)) { $participant->moderator = 1; } $participant->save(); } } return Redirect::action('roomController@own'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($buildingId) { return Room::where('building_id', $buildingId)->get(); }
public function preview() { $rooms = Room::where("available", true)->get(); $days = Timeslot::orderBy("id", 'desc')->first()->day; $presentations = Presentation::where('conference_id', '=', get_current_conference_id())->whereNotNull('timeslot')->get(); $timeslots = Timeslot::where('conference_id', '=', get_current_conference_id())->get(); return view('timeslots.preview', compact('timeslots', 'rooms', 'presentations', 'days')); }
public function join_pin(Request $request) { //validate options $validator = ['access_pin' => ['required', 'numeric'], 'g-recaptcha-response' => 'required|captcha']; //tsipizic for unit testing no captcha if ($request->getHost() == 'localhost') { $validator = ['access_pin' => ['required', 'numeric']]; } $this->validate($request, $validator); $access_pin = $request->input('access_pin'); $room = Room::where('access_pin', $access_pin)->first(); if ($room) { //check if meeting running and create if needed $bbb_id = bbbController::running($room); if (!$bbb_id) { $bbb_id = bbbController::create($room); } //join meeting $bbb = new BigBlueButton($bbb_id); $params = array('meetingId' => $room->bbb_meeting_id, 'username' => 'test', 'userId' => '', 'webVoiceConf' => '', 'password' => $room->att_pass); try { $result = $bbb->getJoinMeetingURL($params); } catch (Exception $e) { throw new Exception($e->getMessage() . "\n"); } return redirect($result); } else { return view('room.withPin')->withErrors(trans('room.not_found')); } }
/** * DELETE /rooms/{roomId} * * @param $roomId * */ public function deleteRoom($roomId) { Room::where('id', '=', $roomId)->delete(); Progression::where('id', '=', $roomId)->delete(); }
/** * validate room number * deprecated not in use anymore * * @param Request $request * @return mixed * * */ public function admin_check_rnum(Request $request) { $info = Room::where('room_num', $request->input('id'))->count(); return $info; }
Emploi du temps : {{ $cr->nom_classe }} <div class="actions_btn"> <ul> <li><a id="imprimer" href="#"><img src="{{ asset('images/imprimer.png') }}">Imprimer</a></li> </ul> </div> </header> <div class="panel-body"> <div style="width:700px;" > <div class="left" style="width: 80px;"> <table> <?php $matieres = \Auth::user()->matters()->get(); $salles = \App\Room::where('user_id', \Auth::user()->id)->get(); ?> @foreach($cr->matters as $mat) <tr class="mat"> <td> <div data-id="{{ $mat->id }}" color="{{ $mat->color }}" class="item francais" style="background-color:{{ $mat->color }};width:50px">{{ $mat->code_matiere }}</div> </td> </tr> @endforeach </table> <table class="classes forrooms"> @foreach($salles as $s) <tr> <td><div data-salle-id="{{ $s->id }}" color="{{ $s->color }}" style="color:white; background-color:{{ $s->color }} !important;width:50px " class="item2">{{ $s->nom_salle }}</div></td> </tr> @endforeach
public function PostRoomNumberView() { $roomnum = Input::get('rnumber'); $roomnocheck = Room::where('institute_code', '=', Auth::user()->institute_id)->where('room_no', '=', $roomnum)->count(); if ($roomnocheck == 1) { Session::flash('warn', 'This Room already allocated for another class Please Try another !'); return Redirect::to('add/room/number'); } else { $iid = Institute::where('institute_code', '=', Auth::user()->institute_id)->pluck('institute_code'); // /return $iid; $radd = new Room(); $radd->institute_code = $iid; $radd->room_name = Input::get('rname'); $radd->room_no = Input::get('rnumber'); $radd->note = Input::get('note'); $radd->save(); Session::flash('data', 'Data successfully added !'); return Redirect::to('add/room/number'); } }
public function supprimer() { if (\Request::ajax()) { $numbers = substr(\Input::get('boxes'), 0, -1); $ids = explode(',', $numbers); $ids = array_unique($ids); foreach ($ids as $id) { $b = Room::where('user_id', \Auth::user()->id)->where('id', $id)->first(); $b->delete(); } } }
public function store(Request $request) { if (Room::count() == 0) { flash()->error("You must add at least one room before creating\n a conference"); return back()->withInput(); } $this->validate($request, ['name' => 'required|min:5|max:255']); $first = $request['start_time']; $last = $request['end_time']; if (empty($first[0]) or empty($last[0])) { flash()->error("You must add a start time and an end time"); return back()->withInput(); } $conference = new Conference(); $conference->name = $request['name']; $conference->save(); $rooms = Room::where('available', true)->get(); $numDays = sizeOf($first); //start day loop from here if ($numDays == 1) { $times = []; $tStart = strtotime($first[0]); $tEnd = strtotime($last[0]); $tNow = $tStart; $i = 1; $times[0] = date("H:i", $tNow) . "\n"; while ($tNow < $tEnd) { $tNow = strtotime('+30 minutes', $tNow); $times[$i] = date("H:i", $tNow) . "\n"; $i = $i + 1; } foreach ($rooms as $room) { foreach ($times as $time) { $timeslot = new Timeslot(); $timeslot->day = 1; $timeslot->room_code = $room->code; $timeslot->conference_id = $conference->id; $timeslot->time = $time; $timeslot->save(); } } } else { for ($day = 1, $index = 0; $day < $numDays || $index < $numDays - 1; $day++, $index++) { $times = []; $tStart = strtotime($first[$index]); $tEnd = strtotime($last[$index]); $tNow = $tStart; $i = 1; $times[0] = date("H:i", $tNow) . "\n"; while ($tNow < $tEnd) { $tNow = strtotime('+30 minutes', $tNow); $times[$i] = date("H:i", $tNow) . "\n"; $i = $i + 1; } //$i os the number of timeslots foreach ($rooms as $room) { foreach ($times as $time) { $timeslot = new Timeslot(); $timeslot->day = $day; $timeslot->room_code = $room->code; $timeslot->conference_id = $conference->id; $timeslot->time = $time; $timeslot->save(); } } } } flash()->success("New conference created successfully!!"); return redirect()->route('user.show'); }