Пример #1
0
 /**
  * make shure the username is valid for this room
  *
  * @param $newName string
  * @param $roomName string
  * @return bool
  */
 public function isUnique($newName, $roomName)
 {
     $room = Room::where('name', '=', $roomName)->first();
     $count = User::where('room_id', '=', $room->id)->where('connected', '=', 1)->where('name', '=', $newName)->count();
     $this->validationErrors->add('name', 'This name has already been taken :(');
     return $count === 0 ? true : false;
 }
 /**
  * Show the form for editing the specified room.
  *
  * @param  int $id
  * @return Response
  */
 public function getEdit($id)
 {
     $room = Room::find($id);
     $rooms = Room::where('property_id', Property::getLoggedId())->where('type', '<>', 'plan')->where('id', '<>', $id)->lists('name', 'id');
     $formulaTypes = Room::$formulaTypes;
     return View::make('rooms.edit', compact('room', 'formulaTypes', 'rooms'));
 }
Пример #3
0
 public function subscribe($connection, $topic, $room_name = null)
 {
     //check if room exists
     if ($room = Room::where('name', '=', $room_name)->first()) {
         //save current room to database
         $user = $room->users()->save($connection->WhatUp->user);
         //save user to $rooms array so we have an easy accessible collection
         //of all currently connected users
         $this->rooms[$room_name][$user->session_id] = $user;
         //save current topic a.k.a room and this instance to the conneciton
         $connection->WhatUp->currentRoom = $topic;
         $connection->WhatUp->handler = $this;
         //broadcast that a new user is joined to other subscribers of this room
         $msg = array('action' => 'newUser', 'user' => $user->toJson(), 'msg' => 'User ' . $user->name . ' joined.');
         $this->broadcast($topic, $msg, $exclude = array($user->session_id));
         //list all currently connected subscribers to the new guy
         foreach ($this->rooms[$room_name] as $subscriber) {
             if ($subscriber->session_id != $user->session_id) {
                 $msg = array('action' => 'newUser', 'user' => $subscriber->toJson());
                 $this->broadcast($topic, $msg, $exclude = array(), $eligible = array($user->session_id));
             }
         }
     } else {
         //room does not exist
         $connection->close();
     }
 }
Пример #4
0
 public function editEvent($id)
 {
     $rooms = Room::where('id', '>', 0)->get();
     View::share('rooms', $rooms);
     $squeeb = Lecture::where('id', '=', $id)->first();
     View::share('squeeb', $squeeb);
     return View::make('organiser.edit');
 }
Пример #5
0
 public function rooms()
 {
     Mate::where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))->delete();
     Room::where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))->delete();
     Room::where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->where('state', 'LIKE', 'end%')->delete();
     $rooms = Room::orderBy('created_at', 'DESC')->paginate();
     return View::make('prepare.rooms', ['rooms' => $rooms]);
 }
Пример #6
0
 public function get_index($city = null)
 {
     $inputs = array('pmin' => Input::get('pmin'), 'pmax' => Input::get('pmax'), 'smin' => Input::get('smin'), 'smax' => Input::get('smax'), 'smoking' => Input::get('smoking'), 'pets' => Input::get('pets'), 'toilet' => Input::get('toilet'), 'shower' => Input::get('shower'), 'kitchen' => Input::get('kitchen'), 'order' => Input::get('order'));
     if (!is_null($city)) {
         $inputs['city'] = str_replace('-', ' ', $city);
     } else {
         $inputs['city'] = Input::get('city');
     }
     $rules = array('city' => 'exists:photos, city');
     $v = Validator::make($inputs['city'], $rules);
     $query = Room::where('status', '=', 'publish');
     if (!empty($inputs['city'])) {
         $city = $inputs['city'];
         $query->where(function ($query) use($city) {
             $query->where('city', 'LIKE', '%' . $city . '%');
             $query->or_where('description', 'LIKE', '%' . $city . '%');
             $query->or_where('title', 'LIKE', '%' . $city . '%');
         });
     }
     if (!empty($inputs['pmin']) && !empty($inputs['pmax'])) {
         $query->where('price', '>', $inputs['pmin']);
         $query->where('price', '<', $inputs['pmax']);
     }
     if (!empty($inputs['smin']) && !empty($inputs['smax'])) {
         $query->where('surface', '>', $inputs['smin']);
         $query->where('surface', '<', $inputs['smax']);
     }
     if (!empty($inputs['smoking'])) {
         $query->where('smoking', '=', $inputs['smoking']);
     }
     if (!empty($inputs['pets'])) {
         $query->where('pets', '=', $inputs['pets']);
     }
     if (!empty($inputs['toilet'])) {
         $query->where('toilet', '=', $inputs['toilet']);
     }
     if (!empty($inputs['shower'])) {
         $query->where('shower', '=', $inputs['shower']);
     }
     if (!empty($inputs['kitchen'])) {
         $query->where('kitchen', '=', $inputs['kitchen']);
     }
     if (!empty($inputs['order']) && $inputs['order'] == 'price' || $inputs['order'] == 'created_at') {
         $query->order_by($inputs['order'], 'desc');
     } else {
         $query->order_by("created_at", 'desc');
     }
     $total = $query->get();
     $rooms = $query->paginate(Room::$per_page);
     Input::flash();
     if (!$v->fails()) {
         $bgphoto = Photo::where('city', '=', $inputs['city'])->first();
         return View::make('home.search')->with('total', $total)->with('bgphoto', $bgphoto)->with('city', $city)->with('rooms', $rooms);
     } else {
         return View::make('home.search')->with('total', $total)->with('rooms', $rooms);
     }
 }
Пример #7
0
 public function get_rooms()
 {
     $query = Room::where('status', '=', 'publish');
     if (isset($_GET['order']) && isset($_GET['by'])) {
         $query->order_by($_GET['by'], $_GET['order']);
     }
     $query->order_by('created_at', 'desc');
     $rooms = $query->paginate(Room::$per_page);
     return View::make('admin.rooms.index')->with('rooms', $rooms);
 }
Пример #8
0
 public function getIndex()
 {
     $key = Input::get('search');
     if (isset($key)) {
         $data = Room::where('name', 'like', '%' . $key . '%')->orderBy('id', 'desc')->paginate(10);
     } else {
         $data = Room::orderBy('id', 'desc')->paginate(10);
     }
     return View::make('home/dashboard', array())->nest('content', 'room/index', array('data' => $data));
 }
 public function update($id, Request $request)
 {
     $room = Room::where('id', '=', $id)->firstOrFail();
     $room->update($request->all());
     if (Input::file('img')) {
         $image = Input::file('img');
         $destinationPath = public_path() . '/room/' . $thisObject->id . '/';
         $filename = $image->getClientOriginalName();
         $image->move($destinationPath, $filename);
     }
     return redirect('rooms');
 }
Пример #10
0
 public function createRoom($buildingid)
 {
     //count position
     $position = count(Room::where('building_id', '=', $buildingid)->get()) + 1;
     $room = new Room();
     $room->name = Input::get("roomname");
     $room->position = $position;
     $room->building_id = $buildingid;
     $room->save();
     //fetch created id
     $id = $room->id;
     return Redirect::to('/building/' . $buildingid . '/' . $id);
 }
Пример #11
0
 public function update(Request $request, $id)
 {
     $client = Client::where('id', $id)->first();
     $client->surname = $request->input('surname');
     $client->name = $request->input('name');
     $client->age = $request->input('age');
     $client->room_id = $request->input('room_id');
     $client->save();
     $room = $request->input('room_id');
     $false = Room::where('id', $room)->first();
     $false->free = 0;
     $false->save();
     return $client;
 }
 public function filterTransaction()
 {
     $rType = Input::get('rType');
     $sType = Input::get('sType');
     $response = array();
     if (empty($sType) && !empty($rType)) {
         $transactions = CottageReservation::where('reservation_type', '=', $rType)->get();
     } elseif (!empty($sType) && !empty($rType)) {
         $transactions = CottageReservation::where('reservation_type', '=', $rType)->where('status', '=', $sType)->get();
     } else {
         $transactions = CottageReservation::where('status', '=', $sType)->get();
     }
     foreach ($transactions as $transaction) {
         $roomname = Room::where('rnid', '=', $transaction['room_id'])->first();
         $userInfo = UserInfo::where('user_id', '=', $transaction['user_id'])->first();
         $reservation_type = ReservationType::find($transaction['reservation_type'])->first();
         if ($transaction['reservation_type'] == "1") {
             if ($transaction['day_type'] == 1) {
                 $time = "Morning";
             } else {
                 $time = "Overnight";
             }
         } else {
             $time = date("g:i a", strtotime($transaction['check_in_datetime']));
         }
         //cottage list
         /*
                     $cottagelists = explode(",", $transaction['cottagelist_id']);
                     foreach($cottagelists as $list)
                     {
                     	$cottagename = CottageList::where('cottagelist_id','=',$list)->first();
                     	
                     	
                     	
                     	if(!in_array($cottagename['cottagename'], $cottagelists))
         				{
         					$a[count($cottagelists)] = $cottagename['cottagename'];
         				}
                     }*/
         $all = CottageList::all();
         $cottagelists = explode(",", $transaction['cottagelist_id']);
         $cottagelists2 = array();
         foreach ($all as $cottagename) {
             if (in_array($cottagename['cottagelist_id'], $cottagelists)) {
                 $cottagelists2[count($cottagelists2)] = $cottagename['cottagename'] . "<br>";
             }
         }
         $a = $cottagelists2;
         $response[] = array("id" => $transaction['id'], "fname" => $userInfo['firstname'], "lname" => $userInfo['lastname'], "rtpe" => $reservation_type['name'], "rdate" => $transaction['reservation_date'], "status" => $transaction['status'], "room_name" => !empty($roomname) ? $roomname['roomname'] : "", "cottage_name" => $a, "ttime" => $time);
     }
     return $response;
 }
 public function clientBookingStep2()
 {
     $i = Input::all();
     $x = [];
     $room_reservation['reservation_room'] = [];
     $i['checkin'] = Session::get('reservation.checkin') . ' 12:00:00';
     $i['checkout'] = Session::get('reservation.checkout') . ' 11:59:00';
     $room_reservation['checkin'] = Session::get('reservation.checkin') . ' 12:00:00';
     $room_reservation['checkout'] = Session::get('reservation.checkout') . ' 11:59:00';
     $room_reservation['display_checkout'] = Session::get('reservation.display_checkout');
     foreach ($i['rooms'] as $r) {
         if ($r['quantity'] > 0) {
             array_push($room_reservation['reservation_room'], $r);
         }
     }
     $count = 0;
     $rooms = [];
     foreach ($room_reservation['reservation_room'] as $room) {
         $count++;
         $r = Room::where('id', $room['room_id'])->select('id', 'name', 'price')->first();
         $room_reservation['reservation_room'][$count - 1]['room_details'] = $r;
         array_push($rooms, $r);
     }
     Session::put('reservation', $room_reservation);
     foreach (Session::get('reservation')['reservation_room'] as $rooms) {
         $count++;
         $room_id = $rooms['room_details']['id'];
         $available_rooms = [];
         $room_qty = RoomQty::with(array('roomPrice', 'roomReserved' => function ($query) use($i, $room_id) {
             $query->where(function ($query2) use($i, $room_id) {
                 $query2->whereBetween('check_in', array($i['checkin'], $i['checkout']))->orWhereBetween('check_out', array($i['checkin'], $i['checkout']))->orWhereRaw('"' . $i["checkin"] . '" between check_in and check_out')->orWhereRaw('"' . $i["checkout"] . '" between check_in and check_out');
             })->where(function ($query3) {
                 $query3->where('status', '!=', 5)->where('status', '!=', 3);
             });
         }))->where('room_id', $room_id)->where('status', 1)->get();
         foreach ($room_qty as $available) {
             if ($available->roomReserved == '[]' || count($available->roomReserved) == 0) {
                 array_push($available_rooms, $available);
             }
         }
         if (count($available_rooms) < $rooms['quantity']) {
             return Redirect::to('booking/step2')->with('error', 'Some rooms you booked is not available');
         }
     }
     return Redirect::to('booking/step3');
 }
    //this will output the second layout
});
Route::get('testpaypal', 'PaypalController@prepareExpressCheckout');
Route::get('room1', function () {
    $cpage = 'room';
    return View::make('clientview.room', compact('cpage'));
});
Route::post('reservation/proceed', function () {
    $i = Input::all();
    Session::put('checkin', $i['checkin']);
    Session::put('checkout', $i['checkout']);
    Session::put('reserved_room_id', $i['id']);
    return $i;
});
Route::get('room/{id}', function ($id) {
    $room = Room::where('id', $id)->with('roomQty', 'roomImages.photo')->first();
    $cpage = 'room';
    if (!empty($room)) {
        return View::make('clientview2.room.show', compact('room', 'cpage'));
    }
    return Redirect::to('room');
});
Route::post('room/{id}/availability', function ($id) {
    $i = Input::all();
    $i['checkin'] = date('Y-m-d 12:00:00', strtotime($i['checkin']));
    $i['checkout'] = date('Y-m-d 11:59:59', strtotime('+' . $i['nights'] . ' day', strtotime($i['checkin'])));
    $available_rooms = 0;
    $room1 = [];
    //$roomDetails = Room::where('id')->first();
    $room = RoomQty::where('room_id', $id)->with(array('roomReserved' => function ($query) use($id, $i) {
        $query->where(function ($query2) use($id, $i) {
Пример #15
0
	}else if(!isset($_SESSION['step_02_completed']) || $_SESSION['step_02_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-02'));
	}else if(!isset($_SESSION['step_03_completed']) || $_SESSION['step_03_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-03'));
	}else if(!isset($_SESSION['step_04_completed']) || $_SESSION['step_04_completed'] != true){
		die(header('Location: ' . DOMAIN . 'dashboard/add-hotel/step-04'));
	}

	if(isset($_SESSION['hotel_step_error']) && (strlen($_SESSION['hotel_step_error']) > 0)){
?>
<div><?php echo $_SESSION['hotel_step_error']; $_SESSION['hotel_step_error'] = ''; ?></div>
<?php } ?>
<?php
	$hotel_id = isset($_SESSION['editing_hotel']) ? $_SESSION['editing_hotel'] : -1;
	$room = new Room();
	$roomTypes = $room->where('hotel_id', '=', $hotel_id)
		->join('room_types', 'rooms.room_type_id', '=', 'room_types.id')
		->select('rooms.*', 'room_types.name as room_type_name', 'room_types.id as room_type_id')
		->get();
?>
<form action="<?php echo HTTP; ?>dashboard/get_step_06.php" method="post">
	<input type="hidden" value="ec14f83d70784a0c311a09533c9f9a23" name="csrf"/>
	<fieldset>
		<legend>Hotel Registration/Property-details</legend>
		<h3 class="h3">Assign rooms</h3>

		<table class="table table-bordered">
			<thead>
				<tr>
					<th>Room type</th>
					<th>Assigned quantity</th>
 public function update($id)
 {
     $cpage = 'roommgt';
     $room = Room::where('id', $id)->with('roomImages.photo')->first();
     if (!empty($room)) {
         return View::make('adminview.room.update', compact('cpage', 'room'));
     }
 }
Пример #17
0
 public function getRooms($id)
 {
     $data = Room::where('type_id', $id)->get();
     $html = '';
     $html .= '<option></option>';
     foreach ($data as $d) {
         $html .= '<option value="' . $d->id . '">' . $d->name . '</option>';
     }
     echo $html;
 }
Пример #18
0
 public function postDeleteRoom()
 {
     $validator = Validator::make(Input::all(), array('ID' => 'required'));
     if ($validator->fails()) {
         return View::make('admin.failed');
     } else {
         $myid = Input::get('ID');
         $profile = Room::where('id', '=', $myid)->first();
         $deleted = $profile->delete();
         return View::make('admin.success');
     }
     return View::make('admin.failed');
 }
Пример #19
0
	}else{
		$checkIn = $_POST['check_in'];
		$checkOut = $_POST['check_out'];
		if(isset($_POST['hotel']) && is_numeric($_POST['hotel'])){
			$hotelId = intval($_POST['hotel']);
			$_SESSION['booking_hotel_id'] = $hotelId;
		}else{
			$_SESSION['booking_nav_error'] = 'Looks like you want to start again.';
			die(header('Location: ' . $_SESSION['page_url']));
		}

		$hotel = new Hotel();
		$room = new Room();
		$bookedDate = new BookedDate();
		$availability = new Availability();

		$avRooms = $room->where('rooms.hotel_id', '=', $hotelId)
			->join('availabilities', 'rooms.id', '=', 'availabilities.room_id')
			->whereRaw('availabilities.no_of_rooms > availabilities.booked_rooms')
			->join('booked_dates', 'availabilities.room_id', '=', 'booked_dates.room_id')
			->whereRaw('booked_dates.no_of_rooms > availabilities.booked_rooms')
			->get();
		if(count($avRooms)){
			$_SESSION['booking_step_01_completed'] = true;
			die(header('Location: ' . DOMAIN . "bookings/{$hotel->seo_url}/step-02"));
		}else{
			$_SESSION['booking_nav_error'] = 'No rooms available for the mentioned period.';
			die(header('Location: ' . $_SESSION['page_url']));
		}
	}
?>
Пример #20
0
		$rmvdRoomIds[] = $rmvdHotel->room_id;
		$bookedRooms[] = $rmvdHotel->booked_rooms;
	}
	unset($rmvdHotels);
	// (===----------=====) or (===----------=====] or [===----------=====)
	$rmvdHotels = $bookedDate->where('checked_in', '>=', $searchBag['check_in'])
		->where('checked_out', '<=', $searchBag['check_out'], 'AND')
		->get();
	foreach($rmvdHotels as $rmvdHotel){
		$rmvdRoomIds[] = $rmvdHotel->room_id;
		$bookedRooms[] = $rmvdHotel->booked_rooms;
	}
	unset($rmvdHotels);

	foreach($rmvdRoomIds as $k => $rmvdRoomId){
		$x = $room->where('rooms.id', '=', $rmvdRoomId)
			->where('rooms.assigned_rooms', '>=', $bookedRooms[$k] + $searchBag['rooms'], 'AND')
			->join('hotels', 'rooms.hotel_id', '=', 'hotels.id')
			->whereIn('hotels.id', [$hotel->id])
			->select(
				'rooms.id as room_id',
				'rooms.room_type_id as room_type_id',
				'rooms.room_feature_ids as room_feature_ids',
				'rooms.no_of_rooms as room_no_of_rooms',
				'rooms.assigned_rooms as room_assigned_rooms',
				'rooms.max_persons as room_max_persons',
				'rooms.max_extra_beds as room_max_extra_beds'
			)
			->first();
		$avlblHotels[] = $x ? $x : '';
		unset($x);