本文整理汇总了PHP中Room::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::where方法的具体用法?PHP Room::where怎么用?PHP Room::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isUnique
/**
* 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;
}
示例2: getEdit
/**
* 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: subscribe
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: editEvent
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: rooms
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: get_index
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: get_rooms
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: getIndex
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));
}
示例9: update
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: createRoom
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: update
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;
}
示例12: filterTransaction
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;
}
示例13: clientBookingStep2
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');
}
示例14: function
//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: if
}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>