Aronaman
1 month ago
159
3
Laravel

query filter

Posted 1 month ago by Aronaman

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 sign in or create an account to participate in this conversation.