Hi @aronaman
Try this one
$q2->where('check_in','>=',$check_out)
->Where('check_out','<=',$check_in);
can you show here your database schema
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
d/m/y . ... and 02/01/20 -03/01/20 room 101 booked.
14/01/20-21/01/20 101 and 201 booked.
my question is on 03/01/20 - 14/01/20 both 101 and 201 available, but in my query getting 101, 101, 201, is there is other way ???
$roomNotReserve =$room->bookings()
->whereNotIn('book_status_id',$statusCollect)
->where(function($q2) use ($check_in, $check_out) {
$q2->where('check_in','>=',$check_out)
->orWhere('check_out','<=',$check_in);
})->with('individualRooms')->get()->pluck('individualRooms')->toArray();
$q2->where('check_in','>=',$check_out)
->orWhere('check_out','<=',$check_in);
not consider the repetition!! same room booked on the different dates are all show up.
Please or to participate in this conversation.