Level 122
Please format your code by putting 3 backticks ``` on a line before and after each code block
Summer Sale! All accounts are 50% off this week.
My Requirement
Hotel Rooms to be booked on availability basis. The bookings are recorded in the bookingmaster table, with starting date and ending date as colulmns. Based on the availability of dates in the booking master table, the room ids are fetchd from roommaster table (roommaster id is referenced in the booking masters). Please advise
$roommaster = DB::table("roommasters")->select('roomid')
->whereIn('roomid', function ($query) use ($startTime2, $endTime2) {
$query->select('roommasters_id')
->from('bookingmasters')
->where(function ($query3) use ($startTime2, $endTime2) {
$query3
->where('bookingenddate', '<', $startTime2);
})
->orWhere(function ($query2) use ($startTime2, $endTime2) {
$query2
->where('bookingstartdate', '>', $startTime2)
->where('bookingstartdate', '>', $endTime2);
});
})
->get();
Please or to participate in this conversation.