简体   繁体   English

Laravel 中的酒店房间列表

[英]Hotel Room Listing in Laravel

I am trying to build hotel room booking management system using Laravel.我正在尝试使用 Laravel 构建酒店客房预订管理系统。

Problem in retrieving room available based on the user search in the portal根据门户中的用户搜索检索可用房间的问题

Hotel has many rooms and rooms has many tariff based on the date.酒店有很多房间,房间有很多基于日期的关税。 I need all the room tarrif based on the check in and check out date.我需要根据入住和退房日期的所有房间 tarrif。 But i am getting all the records which are there in database between that days.但是我得到了那几天之间数据库中的所有记录。 I want only the room which are available on all the days.我只想要一整天都可以使用的房间。

Example: User is searching hotel from 19-11-2019 to 22-11-2019.示例:用户从 19-11-2019 到 22-11-2019 搜索酒店。 But some hotel inventory are not there on 21-11-2019.但在 2019 年 11 月 21 日,一些酒店库存不存在。 But i am getting that records.I want the records which are available on all the days.(ie 19-11-2019,20-11-2019,21-11-2019,22-11-2019)但我得到了这些记录。我想要所有日子都可用的记录。(即 19-11-2019,20-11-2019,21-11-2019,22-11-2019)

HotelPriceDetail::where('room_id',$value->room_id)
                  ->whereBetween('hotel_price_details.date',[$check_in,$check_out])
                  ->where('hotel_price_details.inventory','>=',$total_adults)
                  ->get();

Can any one suggest me what i need to change in my code.任何人都可以建议我在我的代码中需要更改什么。

Can you dump your $check_in and $check_out variables?你能转储你的 $check_in 和 $check_out 变量吗? I'm not sure if your date format is correct.我不确定您的日期格式是否正确。 It should be something like this它应该是这样的

$from = date('2019-11-19');
$to = date('2019-11-22');

HotelPriceDetail::whereBetween('hotel_price_details.date', [$from, $to])->get();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM